If there is no callback, the item will be in-active state
// No Callback
ActionSheetCardItem(sfSymbolName: "record.circle", label: "Record")
Use the sheet in your main view within a ZStack, otherwise the black background view will not show correctly
var body: some View {
ZStack {
content
sheetView
}
}
For more examples open /Demo/Demo.xcodeproj
How to Change color and fonts of the sheet items
// If font and color is not provide, default values will be used
ActionSheetCardItem(
label: "Stop",
sfSymbolName: "stop",
labelFont: Font.largeTitle,
foregrounColor: Color.red,
foregroundInactiveColor: Color.gray
) {
print("Stop Tapped")
showingSheet = false
},
ActionSheetCard
A SwiftUI based custom sheet card to reuse in iOS application.
If you want to learn how to build this type of component try the following tutorial.
Features
Related Library
How to use
Add this Swift package to your project
Import and use
Steps
Add
import ActionSheetCard
in your SwiftUI ViewDefine a
@State var showingSheet = false
stateCreate the sheet view and pass the state as binding and define some items for the sheet
Pass a callback to define the item, so when it is tapped the callback will execute
If there is no callback, the item will be in-active state
Use the sheet in your main view within a
ZStack
, otherwise the black background view will not show correctlyFor more examples open
/Demo/Demo.xcodeproj
How to Change color and fonts of the sheet items
How to Change color of the sheet card background
Questions or feedback?