We have a @StateObject that holds the current navigation state. The root view of the app renders the appropriate view
switch (navigation.route) {
case .showUpgrade :
UpdateRequiredView(vm:vm)
case .initial :
OnboardingCarouselView(vm: vm)
case .signin :
SignInView(vm: vm)
case .birthdate:
BirthdateView(vm:vm)
case .name:
NameView(vm: vm)
case .mainView :
MainTabView().environmentObject(self.navigation)
}
on iOS 16, when moving to .mainView, we get the following crash
Crashed: com.apple.main-thread
0 SwiftUI 0x817208 OUTLINED_FUNCTION_2 + 620
1 SwiftUI 0x817220 OUTLINED_FUNCTION_2 + 644
2 SwiftUI 0x125cbc4 OUTLINED_FUNCTION_2 + 424
3 SwiftUI 0x68244 OUTLINED_FUNCTION_441 + 600
4 SwiftUI 0x47dd0 OUTLINED_FUNCTION_194 + 572
5 UIKitCore 0x1b7c84 -[UIViewController removeChildViewController:notifyDidMove:] + 128
6 UIKitCore 0x77bf7c -[UINavigationController removeChildViewController:notifyDidMove:] + 80
7 UIKitCore 0x205a10 -[UIViewController dealloc] + 768
8 UIKitCore 0x10030 -[UINavigationController viewDidDisappear:] + 372
9 UIKitCore 0xd68c -[UIViewController _setViewAppearState:isAnimating:] + 1008
10 UIKitCore 0x46ea90 -[UIViewController __viewDidDisappear:] + 152
11 UIKitCore 0x7e9e3c __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke_3 + 44
12 UIKitCore 0x1a4a14 -[UIViewController _executeAfterAppearanceBlock] + 84
13 UIKitCore 0x1a4958 -[_UIAfterCACommitBlock run] + 72
14 UIKitCore 0x1a488c -[_UIAfterCACommitQueue flush] + 176
15 UIKitCore 0x1a4798 _runAfterCACommitDeferredBlocks + 496
16 UIKitCore 0x3f6c0 _cleanUpAfterCAFlushAndRunDeferredBlocks + 108
17 UIKitCore 0x449d70 _afterCACommitHandler + 84
18 CoreFoundation 0x92070 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
19 CoreFoundation 0x1a690 __CFRunLoopDoObservers + 532
20 CoreFoundation 0x7bf8c __CFRunLoopRun + 1048
21 CoreFoundation 0x811e4 CFRunLoopRunSpecific + 612
22 GraphicsServices 0x1368 GSEventRunModal + 164
23 UIKitCore 0x3a2d88 -[UIApplication _run] + 888
24 UIKitCore 0x3a29ec UIApplicationMain + 340
25 SwiftUI 0x1dace8 OUTLINED_FUNCTION_895 + 2424
26 SwiftUI 0x137c24 block_copy_helper.1 + 388
27 SwiftUI 0x120b44 OUTLINED_FUNCTION_901 + 2804
28 Zoog 0x2bece4 main + 40 (<compiler-generated>:40)
29 ??? 0x1ce14d948 (Missing)
Please help