Giter VIP home page Giter VIP logo

Comments (7)

f3dm76 avatar f3dm76 commented on August 23, 2024 2

Hey @rifqifadh, I think I found a solution using Apple's fullScreenCover, please check it out:

extension View {

    func transparentFullScreenCover<Content: View>(isPresented: Binding<Bool>, content: @escaping () -> Content) -> some View {
        fullScreenCover(isPresented: isPresented) {
            ZStack {
                content()
            }
            .background(TransparentBackground())
        }
    }
}

struct TransparentBackground: UIViewRepresentable {

    func makeUIView(context: Context) -> UIView {
        let view = UIView()
        DispatchQueue.main.async {
            view.superview?.superview?.backgroundColor = .clear
        }
        return view
    }

    func updateUIView(_ uiView: UIView, context: Context) {}
}

Use like this:

        .transparentFullScreenCover(isPresented: $viewModel.isPresentedSettings) {
            Color.black.opacity(0.5).edgesIgnoringSafeArea(.all)
                .popup(isPresented: $viewModel.isPresentedSettings, type: .toast, position: .bottom) {
                    DraggableCardView() {
                        SettingsView(viewModel: ProfileViewModel())
                    }
                }
        }

Sorry if I'm a bit late, have a great day!

from popupview.

f3dm76 avatar f3dm76 commented on August 23, 2024

Hey @rifqifadh, it doesn't seem to be possible to force any view to be shown above navbar view. Navbar just takes priority. What you can do is move your popup up your view hierarchy to be "above" your navigation view. Like this:

NavigationView {
            ...
        }
        .popup(isPresented: $showingTopToast, backgroundColor: .black.opacity(0.5)) {
            Color.red.frame(width: 50, height: 50)
        }

from popupview.

f3dm76 avatar f3dm76 commented on August 23, 2024

It's been a while so I'm closing this one for now, please do let me know if you have any further issues. Have a good day!

from popupview.

owen12ab avatar owen12ab commented on August 23, 2024

Is there any way to achieve this without using fullScreenCover?

from popupview.

JoeOCT91 avatar JoeOCT91 commented on August 23, 2024

Is any way to pass user interaction when using fullScreenCover,
is it possible to manage that by presenting a new UI Window above the current window
@f3dm76

from popupview.

f3dm76 avatar f3dm76 commented on August 23, 2024

Hey @JoeOCT91, this is a pure SwiftUI library though. If using UIKit is acceptable for your project, then please use one of the number of great UIKit popup libraries

from popupview.

f3dm76 avatar f3dm76 commented on August 23, 2024

@JoeOCT91 Why are you tagging me?

from popupview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.