Post

Replies

Boosts

Views

Activity

Reply to SwiftUI views do not respond in UIKit UIViewController
Hi, I am searching a way to present SwiftUI wrapping in UIKit view too. My target is to integrate SwiftUI views into an existing objective-c UIKit app. I've tried [UIView addSubView: mySwiftUICtrl.view] in many ways, but all get frustrated results that my SwiftUI view doesn't respond. Finally I found a way to get my SwiftUI UIHostingController works. That is using MainViewController to present my UIHostingController: [mainViewCtrl presentViewController:mySwiftUICtrl animated:true completion:nil]; and mySwiftUICtrl works normally. (I guess that the mystery "msgchain" in main controller needs to be pass through the UIHostingController.)
Apr ’21