What's Updated in SwiftUI and Combine · Combine Improvements Since WWDC | raywenderlich.com

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/6178532-what-s-updated-in-swiftui-and-combine/lessons/3

I tried the code from the last example, and it crashes when I run it in Xcode 11.2 in the simulator and when returning from the detailview. Error:

2019-11-02 11:22:31.515778+0100 Employees[80175:15321750] *** Assertion failure in -[UINavigationController popToViewController:transition:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3900.12.15/UINavigationController.m:8129

2019-11-02 11:22:31.519144+0100 Employees[80175:15321750] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: 'Tried to pop to a view controller that doesn’t exist.'

Hi! Thanks for the comment - yes, indeed it looks like you ran into something that I didn’t catch when I ran through my code! It turns out that the NavigationView and TabViews were inside out (the TabView should be the outer view, not the NavigationView). I’m sending updated code to the team now to push up to the site - I’ll let you know when that is ready!

what’s the point of leaving the var moc = AppDelegate.currentContext (in 3:00 minutes) after you injected the context through @Environment ? I guess it should be removed.

Yes you’re right - that should be removed - an oversight on my part!