Post

Replies

Boosts

Views

Activity

Toolbar primaryAction on watchOS
I am trying to figure out how to hide the primaryAction ToolbarItem under the navigation bar in a watchOS app written in SwiftUI. I feel like I've followed the documentation but the toolbar item displays without scrolling the view. What is the correct way to show a discoverable toolbar item when the user scrolls up? Apple's documentation states In watchOS the system places the primary action beneath the navigation bar; the user reveals the action by scrolling. Toolbar Placement - primaryAction - https://developer.apple.com/documentation/swiftui/toolbaritemplacement/primaryaction Here is the view that I am using: } The primary action button always displays and is never hidden. I have seen an example where one used a ScrollViewReader to programmatically change the position but I feel like that isn't what Apple has stated is possible and I'm trying to understand what I'm doing wrong. Apple's documentation also states that the toolbar needs to be inside the scrollview: Place a toolbar button only in a scrolling view. People frequently scroll to the top of a scrolling view, so discovering a toolbar button is almost automatic. Placing a toolbar button in a nonscrolling view makes it permanently visible, eliminating the advantage of hiding it when it’s not needed. Toolbar Buttons watchOS - https://developer.apple.com/design/human-interface-guidelines/watchos/elements/toolbar-buttons/
1
0
2.7k
May ’21