Reputation: 53
Can we develop an iOS application with both storyboards and SwiftUI. is there anything like bridging available like we do bridging codes from objective c to swift and vice versa.
Upvotes: 0
Views: 153
Reputation: 21005
Step 1) subclass UIHostingController
class MySwiftUIViewUIController: UIHostingController<MySwiftUIView> {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder, rootView: MySwiftUIView())
}
}
Step 2) In interface builder add a UIHostingController
and set it's subclass
Upvotes: 0
Reputation: 5145
Interface Builder supports adding a UIHostingController
to a storyboard, which is the UIKit controller that can have a SwiftUI subview, but there’s no integration beyond that. You’d have to write your own methods and classes to pass data and actions between them.
Upvotes: 2