Example 1:
ParentView.swift
1 2 3 4 5 6 7 8 9 10 11 12 13 | struct ParentView : View { @State var isPresented = false var body : some View { Button ( action : { self . isPresented = true }, label : { Text ( "Show Child View" ) }). sheet ( isPresented : $ isPresented , content : { ChildView () }) } } |
ChildView.swift
1 2 3 4 5 6 7 8 9 10 11 12 | struct ChildView : View { @Environment (\. presentationMode ) var mode var body : some View { Button ( action : { print ( self . mode . wrappedValue . isPresented ) self . mode . wrappedValue . dismiss () }, label : { Text ( "Dismiss" ) }) } } |
Video Player
00:00
00:00