I'm using a 100% SwiftUI app, currently on Xcode 12 Beta 4
In my ContentView, I have a simple TabView
struct ContentView: View {
		var body: some View {
TabView {
AgendaView()
.tabItem {
Image(systemName: "list.bullet")
Text("Agenda")
}
HealthView()
.tabItem {
Image(systemName: "heart")
Text("Health")
}
}
		}
}
The AgendaView and HealthView have onAppear methods. On App launch, the AgendaView is the one visible, but onAppear is called for both AgendaView and HealthView.
Why is that? Shouldn't onAppear be called only when the view actually appears on screen?
Code for HealthView and AgendaView
struct AgendaView: View {
		var body: some View {
VStack {
Text("Hello, AgendaView!")
}.onAppear{
print("AgendaView.onAppear")
}.onDisappear(){
print("AgendaView.onDisappear")
}
		}
}
struct HealthView: View {
		var body: some View {
VStack {
Text("Hello, HealthView!")
}.onAppear{
print("HealthView.onAppear")
}.onDisappear(){
print("HealthView.onDisappear")
}
		}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
WeatherKit seems to work fine when I deploy a debug build on a real device, but whenever I try to deploy on a simulator, I get the following errors:
2022-09-13 17:51:56.118325-0400 Widget Wizard[63356:284415] [AuthService] Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=AMSErrorDomain Code=12 "Mescal Failed" UserInfo={NSLocalizedDescription=Mescal Failed, NSLocalizedFailureReason=SAPInit failed: -42049}
2022-09-13 17:51:56.119297-0400 Widget Wizard[63356:284415] [WeatherService] Encountered an error when fetching weather data subset; location=<+43.65320000,-79.38320000> +/- 5.00m (speed -1.00 mps / course -1.00) @ 9/13/22, 5:51:55 PM Eastern Daylight Time, error=Error Domain=AMSErrorDomain Code=12 "Mescal Failed" UserInfo={NSLocalizedDescription=Mescal Failed, NSLocalizedFailureReason=SAPInit failed: -42049}
WeatherKitProvider.getWeather error Optional(<+43.65320000,-79.38320000> +/- 5.00m (speed -1.00 mps / course -1.00) @ 9/13/22, 5:51:55 PM Eastern Daylight Time)
Mescal Failed
I have confirmed that everything is configured correctly in terms of certificates and profiles. It just doesn't work on any simulator. It seems a number of people on Twitter are having the same issues.