On iOS 14.2, when using the TabView in SwiftUI in combination with a PageTabViewStyle, the onAppear function of its children will be called excessively. When running the app on iOS 14, onAppear is called exactly once for each child when it appears.
Steps to reproduce:
Steps to reproduce:
Add the following code to a view:
Code Block TabView { Text("First text") .onAppear { print("First text appeared") } Text("Second text") .onAppear { print("Second text appeared") } Text("Third text") .onAppear { print("Third text appeared") } Text("Fourth text") .onAppear { print("Fourth text appeared") } }.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
run the app in a simulator or on a device
swipe through the tabs
The message is printed once when swiping between tabs.
(iOS 14.2) The message is printed multiple times when swiping between tabs.
(iOS 14) The message is printed once when swiping between tabs.