A navigationDestination for <App.Entity> was declared earlier on the stack. Only the destination declared closest to the root view of the stack will be used.

anyone been able to get rid of this error?

A navigationDestination for <App.Entity> was declared earlier on the stack. Only the destination declared closest to the root view of the stack will be used.

Seems to happen when im using a NavigationLink(value:) and a NavigationLink(destination:) in the same class.

I'd think it would make sense to be able to use both methods?

ios16 b5

Accepted Reply

For value-based navigation destinations, don't put the destination modifier right after the NavigationLink. Put it after the List view or whatever your containing view is.

  • thanks, that worked. I'd been splitting out each section on a list to a separate struct file each with their own navigationDestinations so it makes it a bit messy to do this way but that definitely gets rid of the errors and makes scrolling a lot smoother, so looks like ill need to find a better design pattern.

  • And, It will be more smooth

Add a Comment

Replies

For value-based navigation destinations, don't put the destination modifier right after the NavigationLink. Put it after the List view or whatever your containing view is.

  • thanks, that worked. I'd been splitting out each section on a list to a separate struct file each with their own navigationDestinations so it makes it a bit messy to do this way but that definitely gets rid of the errors and makes scrolling a lot smoother, so looks like ill need to find a better design pattern.

  • And, It will be more smooth

Add a Comment