Dialog Sheet
Represents a Material UI styled modal sheet for presenting supplementary content or actions.
Overview
Dialog sheets provide a way to present content that needs user attention, such as forms, detailed information, or additional actions.
The dialogSheet
modifier allows you to display a Material Design styled dialog sheet from any SwiftUI view. It lets you customize the content that appears in the dialog sheet.
To use the dialogSheet
modifier, apply it to any View with the required parameters.
Modifer
Presents a simple dialog sheet over the current view.
dialogSheet(isPresented: Binding<Bool>, _ content: @escaping () -> Content)
Parameters
Property
Description
isPresented
A Binding<Bool>
to control the presentation state of the dialog sheet.
content
A closure returning the view content to be displayed in the dialog sheet.
Example
@State private var showDialogSheet = false
var body: some View {
Container {
Switch("Show Dialog Sheet", isOn: $showDialogSheet)
}
.dialogSheet(isPresented: $showDialogSheet) {
VStack(alignment: .leading, spacing: 15) {
Text("Dialog Sheet")
.font(MaterialUIKit.configuration.h4)
.fontWeight(.bold)
Text("It can contain any custom content.")
.font(MaterialUIKit.configuration.h4)
}
}
}


Last updated