SwiftUI - Is there a popViewController equivalent in SwiftUI?

后端 未结 13 2064
说谎
说谎 2020-12-12 20:18

I was playing around with SwiftUI and want to be able to come back to the previous view when tapping a button, the same we use popViewController inside a

相关标签:
13条回答
  • 2020-12-12 21:19

    This seems to work for me on watchOS (haven't tried on iOS):

    @Environment(\.presentationMode) var presentationMode
    

    And then when you need to pop

    self.presentationMode.wrappedValue.dismiss()
    
    0 讨论(0)
提交回复
热议问题