1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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 () ]) }) } } |