I need to generate a dynamic list of buttons in an ActionSheet
. Say I have an array of options ["Option1", "Option2"]
, how can I achieve this?
.actionSheet(isPresented: self.$showSheet, content: {
ActionSheet(title: Text("Select an option"), buttons: [
.default(Text("Option1")){self.option = 1},
.default(Text("Option2")){self.option = 2},
.default(Text("Option3")){self.option = 3},
.default(Text("Option4")){self.option = 4},
.cancel()])
}