struct ParentView: View {
@State var isPresented = false
@State var backgroundColor = Color.white
var body: some View {
Button(action: {
self.isPresented = true
}, label: {
Text("Show Child View")
.background(backgroundColor)
}).actionSheet(isPresented: $isPresented, content: {
ActionSheet(title: Text("Choose Background Color"), message: Text("choose"), buttons: [
.default(Text("gray"), action: {
self.backgroundColor = Color.gray
}),
.default(Text("yellow"), action: {
self.backgroundColor = Color.yellow
}),
.cancel()
])
})
}
}