I'm rebuilding the 2021 WWDC tutorial "Build a Workout App for Apple Watch" with the latest version of SwiftUI (August, 2022), and some of the old commands have been deprecated. Can someone help me rewrite the following to be compatible with iOS 16 and WatchOS 9?
List(workoutTypes) { workoutType in
NavigationLink(
workoutType.name,
destination: SessionPagingView(),
tag: workoutType,
selection: $workoutManager.selectedWorkout
)
}
I know that init(_:destination:tag:selection:)
was deprecated in iOS 16. Apple recommends using NavigationLink(_:value:)
instead inside a List
within a NavigationStack
or NavigationSplitView
, but I cannot seem to get it to work on Xcode 14 beta 4.0.