Post

Replies

Boosts

Views

Activity

Tab controls not displaying for TabView on watchOS 9.0
The small white dots are not displaying at the bottom of the paging view I've built using TabView and WatchKit for watchOS 9.0. These dots are normally used to indicate which tab view that the user is currently seeing so the user knows to swipe left or right to view a screen to the left or right of the current screen. Also, unexpectedly the first state of the tab view (controls) displays rather than the second state (metrics) that was explicitly declared as the default state. import SwiftUI import WatchKit struct SessionPagingView: View { @State private var selection: Tab = .metrics enum Tab { case controls, metrics, nowPlaying } var body: some View { TabView(selection: $selection) { ControlsView().tag(Tab.controls) MetricsView().tag(Tab.controls) NowPlayingView().tag(Tab.nowPlaying } } }
2
0
1.3k
Aug ’22
How to convert NavigationLink tag and selection to value?
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.
3
2
3.9k
Aug ’22