SwiftUI Pop-up Dialog View Sample
This is example.
import SwiftUI
struct ContentView: View {
@State private var shouldPresentPopUpDialog = false
var body: some View {
ZStack {
Button {
withAnimation {
shouldPresentPopUpDialog = true
}
} label: {
Text("Present Pop-up Dialog")
}
if shouldPresentPopUpDialog {
PopUpDialogView(isPresented: $shouldPresentPopUpDialog) {
Face()
}
}
}
}
}
Put your view in the PopUpDialogView as a content.
PopUpDialogView(isPresented: $shouldPresentPopUpDialog) {
Face()
}
Rock'n'roll!