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

Inspecting conditional toolbar content #265

Open
pteasima opened this issue Oct 9, 2023 · 0 comments
Open

Inspecting conditional toolbar content #265

pteasima opened this issue Oct 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@pteasima
Copy link

pteasima commented Oct 9, 2023

Hi, thanks for the awesome work!

I believe that as of version 0.9.9, inspecting conditional toolbar content is not supported. I.e. if I have a toolbar like:

.toolbar {
  if true {
    ToolbarItem {
      Text("X")
    }
  } else {
    ToolbarItem {
      Text("Y")
    }
  }
}

, there is no way to inspect the Text("X"). You can't .find it, nor can you reach it via .toolbar().item().

Screenshot 2023-10-09 at 16 27 35

FWIW, the workaround Im using is always including the ToolbarItems but making their label conditional:

.toolbar {
  ToolbarItem {
    if true {
      Text("X")
    }
  } 
  //...
}

Can someone please confirm that this problem is real (missing functionality)? Any pointers as to how to implement this would be welcome. I've only scratched the surface of how the introspection works, and Im not sure if supporting @ToolbarContentBuilder is any different from @ViewBuilder. (I guess it shouldn't matter? 🤷‍♂️)

@nalexn nalexn added the bug Something isn't working label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants