Skip to content

Instantly share code, notes, and snippets.

@mgadda
Last active December 26, 2022 18:22
Show Gist options
  • Save mgadda/d9a5731ef5da1e5c96dc135c364bd345 to your computer and use it in GitHub Desktop.
Save mgadda/d9a5731ef5da1e5c96dc135c364bd345 to your computer and use it in GitHub Desktop.
NavigationLink issues
@mgadda
Copy link
Author

mgadda commented Dec 26, 2022

Alternatively, if you revert the inner NavigationLink to the traditional non value-based style, it works as expected.

struct ContentView: View {
  var body: some View {
    let color = Color.pink
    NavigationStack {
      NavigationLink("Colors") {
        NavigationLink("Pink") {
          Rectangle().foregroundColor(color)
        }
      }
    }
  }
}

@mgadda
Copy link
Author

mgadda commented Dec 26, 2022

Also to note: this problem does not occur in Xcode previews but does occur on iOS 16.2 simulator and devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment