Skip to content

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '<SwiftUI.UIKitNavigationController: 0x10282e200> is pushing the same view controller instance #144

Answered by mbrandonw
nick-maker asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @nick-maker, thanks for the project. That helps a lot to see what is going on.

Unfortunately you are just doing something too advanced for SwiftUI to handle. By doing this:

destination = .profile(ProfileDetailModel(destination: .setting(SettingDetailModel())))

…all in one line you are simultaneously dismissing a sheet and pushing two views onto the navigation stack. SwiftUI is just not capable of doing things like that (at least not with navigationDestination), even in vanilla SwiftUI without using our library.

If you want to keep your domain modeled exactly as you have it now, then one potential fix is to space out the destination mutations a bit. You can first nil out the destination

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@nick-maker
Comment options

@mbrandonw
Comment options

Answer selected by nick-maker
@nick-maker
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants