Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd behavior with SwiftDown inside a NavigationSplitView #31

Closed
garrettmurray opened this issue Feb 18, 2024 · 2 comments
Closed

Odd behavior with SwiftDown inside a NavigationSplitView #31

garrettmurray opened this issue Feb 18, 2024 · 2 comments

Comments

@garrettmurray
Copy link

Describe the bug
I started attempting to integrate SwiftDown into a cross-platform SwiftUI project that utilizes a NavigationSplitView, and noticed an odd behavior where SwiftDown seems to always be referencing an older item. I've tried many different variations of utilizing NavigationSplitView, but all of them exhibit this issue. If I use the deprecated NavigationView instead, this problem does not occur.

To Reproduce
Here's some sample code to show off the issue: https://gist.github.com/garrettmurray/4e23b2478f89beae47913a78d9c194a2

You'll note that only the SwiftDown field suffers from this issue—editing via the TextEditor in the same VStack appropriately updates the correct, currently-selected item.

Expected behavior
SwiftDown field would edit the correct item's text, like TextEditor does.

Screenshots
Attaching a video of this bug in action as well, using the sample code linked above.

SwiftDownSplitViewExample.mov

Desktop (please complete the following information):

  • OS: macOS
  • Version 14.3.1
@qeude
Copy link
Owner

qeude commented Feb 18, 2024

👋 Hey, thanks for your feedback! It seems like adding an .id on the SwiftDownEditor that depends on your Item would fix that. I don't have an idea on how I could fix that from the package for now to be honest

@garrettmurray
Copy link
Author

👋 Hey, thanks for your feedback! It seems like adding an .id on the SwiftDownEditor that depends on your Item would fix that. I don't have an idea on how I could fix that from the package for now to be honest

It's hilarious how simple this solution is, and, of course, completely resolves the issue. I was so deep in NavigationSplitView insanity in this project that I completely missed it. Thank you!

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

No branches or pull requests

2 participants