Post

Replies

Boosts

Views

Activity

SwiftUI on Apple Watch - no animation on change of Tabs
Hi everyone, I have an issue on Apple Watch where I am using SwiftUI. When I try to change a tab by pressing a button, the animation of the TabView is not there when one of the tabs contain a List or a ScrollView. It just kind of jumps to the new tab without any animation. When the tabs do not contain a list it works fine. It seems to be a bug with SwiftUI, but maybe I am doing something wrong. The code is as follows: struct MainView: View {     @State var selectedTab  = 0     var body: some View {         VStack {             Button("Change") {                 withAnimation {                     selectedTab = (selectedTab + 1) % 2                 }             }             TabView(selection: $selectedTab) {                 List {                		Text("Hello")                 }.tag(0)                 Text("Hello").tag(1)             }         }     } } Does anyone have a clue of how I can achieve an animation with tabs containing lists?
2
0
824
Oct ’20