This is a library that displays View in a popup.
struct ContentView: View {
@State var isPresented: Bool = false
var body: some View {
VStack {
Text("Popup View")
.padding()
Button("Show Popup") {
self.isPresented.toggle()
}
}
.popup(isPresented: $isPresented, animation: nil, content: {
PopupView(isPresented: self.$isPresented)
})
.edgesIgnoringSafeArea(.all)
}
}
struct PopupView: View {
@Binding var isPresented: Bool
var body: some View {
VStack {
Text("PopupView")
.padding()
Button("Close") {
self.isPresented.toggle()
}
.padding()
}
.frame(width: 300, height: 300)
.background(Color.orange)
.cornerRadius(10)
.padding()
}
}
PopupViewSwiftUI is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PopupViewSwiftUI', '~> 1.0'
PopupViewSwiftUI is available under the MIT license. See the LICENSE file for more info.