this post was submitted on 24 Jun 2023
2 points (100.0% liked)

SwiftUI/Native Apple Development Discussion

37 readers
1 users here now

Discussion about all things SwiftUI-related. Get help with a bug in your code, ask about a new API you want to learn, show off your awesome work, etc.

founded 1 year ago
 

Is it expected behavior that reading an empty NavigationPath back into memory from UserDefaults and then using that path for navigation breaks the app? Nothing renders on the screen, even though my View that should render has its onAppear trigger, and there’s no errors. If the loaded path isn’t empty, it works as expected.

I’ve gotten around this issue by checking if the loaded path is empty, and creating a new one if so. This doesn’t seem right, though.

I was following along with Apple’s tutorial pretty closely. The only other thing I really changed was the .onChange of scenePhase, because it wasn’t triggering as they wrote it. I instead observed the path for changes.

#SwiftUI

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here