UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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?

1      

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

1      

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

1      

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.

1      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.