Is onAppear and onDisappear in a NavigationView of a SwiftUI app behaving as expected?

前端 未结 3 723
滥情空心
滥情空心 2021-02-13 16:18

I would like to know if the behavior of onAppear and onDisappear in SwiftUI (Xcode 11 beta 6 when I wrote this) is what a developer would find more useful or it is just being mo

相关标签:
3条回答
  • 2021-02-13 17:00

    Starting Xcode 11.2 beta (released 02/10/2019), both methods (including .onDisappear()) are being correctly triggered.

    Note that .onDisappear() was not being triggered until this beta release.

    0 讨论(0)
  • 2021-02-13 17:02

    It was a bug on Apple's end.

    .onAppear() now works as it is supposed to in iOS 13.1 and Xcode 11 Beta 7.

    When navigating forwards and backwards to the NavigationView, .onAppear() will trigger.

    0 讨论(0)
  • 2021-02-13 17:03

    Both commands: .onDisappear(perform: ) & .onAppear(perform: )

    are bugging the NavigationView (.navigationBarTitle) feature:

        .navigationBarTitle("Opciones", displayMode: .inline)
    

    When used the navigationBarTitle is removed or not working in the View where you use invoke it. This happens using BOTH: .onDisappear(perform: ) .onAppear(perform: )

    Using Xcode Version 12.2 (12B45b)

    0 讨论(0)
提交回复
热议问题