Post

Replies

Boosts

Views

Activity

Reply to iOS 14 .onAppear() is called on DISappear instead of appear
Create issue, thanks UIKit)) struct UIKitAppear: UIViewControllerRepresentable {     let action: () -> Void     func makeUIViewController(context: Context) -> UIAppearViewController {        let vc = UIAppearViewController()         vc.action = action         return vc     }     func updateUIViewController(_ controller: UIAppearViewController, context: Context) {     } } class UIAppearViewController: UIViewController {     var action: () -> Void = {}     override func viewDidLoad() {         view.addSubview(UILabel())     }     override func viewDidAppear(_ animated: Bool) {         action()     } } public extension View {     func uiKitOnAppear(_ perform: @escaping () -> Void) -> some View {         self.background(UIKitAppear(action: perform))     } } Example: var body: some View { SomeView().uiKitOnAppear { 		 print("I am uiKitAppear") 	 } }
Nov ’20