0

I'm using a TabView inside NavigationView but my app crashes when I try to navigate backwards, it shows this error message "Thread 1: EXC_BAD_ACCESS (code=2, address=0x16ad5bff0)" at AppDelegate class. In ios 14 device it works fine but it crashes on ios 13. I think this is navigationView issue in ios 13. I'm looking for an alternative in iOS 13 and avoid the crash.

PS: I'm using xcode 12.

Sokina
  • 57
  • 2
  • 7

1 Answers1

0

Nesting TabView's inside of NavigationView's has been an issue since SwiftUI started. The cleanest workaround to this is to create view "View layers". Take a look this answer to give you an idea about how they work.

Pure SwiftUI login, signup, register flow, is it possible?

There is a lot that you can do with layering in SwiftUI that feels natural. Check it out and let me know if you have any questions!

BJ Beecher
  • 195
  • 1
  • 5
  • I'm confused can u explain please? – Sokina Dec 22 '20 at 17:55
  • You're essentially creating a wrapper view in swiftui that does something at a higher level in the view hierarchy than the content passed to it. This gives you the ability to control when that next layer (or content that was passed to it) is shown. You can also pass down important information created in that wrapper to the views lower in the view hierarchy via the environment or whatever you like. This gives you the ability to do a lot of things like show overlaid view or go back to an auth screen. You really have a lot of flexibility. – BJ Beecher Dec 22 '20 at 21:13
  • it doesn't work for me.See this link [https://stackoverflow.com/questions/63074464/receive-the-selected-tabview-from-another-view-swiftui] it's my inital question I had a solution but when I update xcode I can anymore go back to first view. Any idea ? – Sokina Dec 23 '20 at 09:15