Post

Replies

Boosts

Views

Activity

Reply to SwiftUI TabView with PageTabViewStyle calls onAppear of children multiple times on iOS 14.2
This situation has gotten even worse in iOS 14.3. The only reliable solution I've found is to abandon .onAppear/.onDisappear, use a @State var to track TabView transitions with .onChange, AND debounce calls to .onChange which can occur one or more times. See: [https://stackoverflow.com/questions/64641759/swiftui-pagetabview-in-ios14-2-will-recall-childview-onappear-method-many-times/65542867#65542867)]
Jan ’21
Reply to SwiftUi strange behaviour (bugs?)
The simplest solution to issue #1 is to place your views (10 or less) into Groups, e.g.: Group { Text("Hello, World! 1 ") Text("Hello, World! 2 ") Text("Hello, World! 3 ") Text("Hello, World! 4 ") Text("Hello, World! 5 ") Text("Hello, World! 6 ") Text("Hello, World! 7 ") Text("Hello, World! 8 ") Text("Hello, World! 9 ") Text("Hello, World! 10 ") } Group { Text("Hello World! 11 ") ... }
Jan ’21