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

Expose the FloatingPanel View #268

Open
rolson opened this issue Feb 28, 2023 · 1 comment
Open

Expose the FloatingPanel View #268

rolson opened this issue Feb 28, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@rolson
Copy link
Contributor

rolson commented Feb 28, 2023

I think it would be nice to expose the floating panel view. I wanted to wrap the PopupView in a floating panel and call it a PopupPanel. I was able to do so, but it required a weird workaround with an empty Spacer view.

public struct PopupPanel: View {
    var popup: Popup?
    var isPresented: Binding<Bool>
    
    public var body: some View {
        Group {
            if let popup, isPresented.wrappedValue {
                // Here is the workaround, it works, but it's awkward.
                ZStack { Spacer() }
                    .floatingPanel(isPresented: isPresented) {
                        PopupView(popup: popup, isPresented: isPresented)
                            .showCloseButton(true)
                            .padding()
                }
            } else {
                EmptyView()
            }
        }
    }
}

If we exposed the FloatingPanel as a View, it would be much easier to do this. But right now it's private to the toolkit.

@rolson rolson added the enhancement New feature or request label Feb 28, 2023
@dfeinzimer
Copy link
Collaborator

Note, the original motivation for exposing the floating panel as a modifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants