BLACK FRIDAY SALE: Save 50% on all my Swift books and bundles! >>

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.

   

Save 50% in my Black Friday sale.

SAVE 50% To celebrate Black Friday, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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.