Just like the question asks, how do I remove the title from the action sheet below? I’m using iOS 14, don’t want to upgrade to SwiftUI
3. There’s no initializer for the actionSheet with a titleVisibility parameter or anything like that. I also tried ‘nil’ as you can see below, but it’s not optional. Not sure how to make the title disappear.
@State var showOptions: Bool = false
Button(action: {
showOptions = true
}, label: {
}).actionSheet(isPresented: $showOptions) {
ActionSheet(
title: nil,
buttons: [
.cancel(),
.default(Text("Red")) {
print("x")
},
.default(Text("Green")) {
print("y")
},
.default(Text("Blue")) {
print("z")
},
]
)
}
2
Answers
ConfirmationDialog can be used to show Action Sheet behaviour without title.
Result of above code
For iOS 14
You can pass empty ActionSheet title like
title: Text("")