Post

Replies

Boosts

Views

Activity

Task, onAppear, onDisappear modifiers run twice
I've run into an issue with my app that I've been able to narrow down to a small reproducer. Any time there is a task associated with the DetailView and you "pop to top", onAppear is called again and the task is re-run. Why is that? Is this a SwiftUI bug? It doesn't happen on iOS 17, only 18. import SwiftUI @Observable class Store { var shown: Bool = true } @main struct MyApp: App { @State private var store = Store() var body: some Scene { WindowGroup { if store.shown { ContentView() } else { EmptyView() } } .environment(store) } } struct ContentView: View { var body: some View { NavigationView { NavigationLink(destination: DetailView()) { Text("Go to Detail View") } } } } struct DetailView: View { @Environment(Store.self) private var store init() { print("DetailView initialized") } var body: some View { Button("Pop to top") { store.shown = false } .task { print("DetailView task executed") } .onAppear { print("DetailView appeared") } .onDisappear { print("DetailView disappeared") } } }
3
0
237
Oct ’24
Remove Rosetta support on Xcode simulators
I'm not sure if having once enabled Rosetta on the Xcode simulators for older builds is a performance issue or not, but it seems like installing apps on them is slower than it used to. I'm trying to completely remove Rosetta support on the simulators but can't figure it out. I've installed Xcode on top of the older version, removed Xcode, removed all the simulators and yet it still shows: iPhone 15 Pro (Rosetta) as a target. Can someone help me remove Rosetta support on the simulators please?
1
0
2.5k
Dec ’23
iOS simulator ImageLoader startup crash on Catalina 10.15.2, Xcode 11.3
I am using Xcode 11.3 and did upgrade to Catalina 10.15.2 today. Everything was running fine before the upgrade and I can't think of anything else that would've caused this.I've tried the typical, clean/build, delete derived data...but nothing has helped.Has anyone else experienced issues with crashing when trying to run in the simulator? See attached image for callstack.
3
0
2.4k
Dec ’19