NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

SOLVED: Apple Workout WatchOS App

Forums > SwiftUI

Can anybody tell me how the workout app on WatchOS has a navigation link inside of a navigation link? I assume it's not how I've just described but each 'Workout' goes to a tab view when tapped to start a workout but within that there's a navigation link in the top right corner (the ellipsis.circle.fill) to edit the workout. I wanted to do something similar but I can't figure out how to make a single List item contain links to two places.

Anybody have an understanding of how that app works?

   

My guess is the ellipsis menu is a custom button which utilizes the new Navigation API. Because when you tip the button you're sent to another list with the same behaviour (depends on the workout, though).

https://developer.apple.com/videos/play/wwdc2022/10054

   

Ah yes I've managed to get it working with a button inside of a button (if I had either of them as a navigation link it didn't seem to work)

So each list item is a button and each button has an ellipsis button in the top corner. Each button navigating to different views by altering the navigation path of the navigation stack.

Thanks

   

A tip: If you have a custom button in a list you can set the button style to .plain. Then it does work together with the NavigationLink.

   

Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.