54.8 Embedding SwiftUI in Code
In this, the final integration example, the SwiftUI view will be embedded into the layout for the initial view controller programmatically. Within Xcode, edit the ViewController.swift file, locate the viewDidLoad() method and modify it as follows:
override func viewDidLoad() {
super.viewDidLoad()
let swiftUIController = UIHostingController(rootView: SwiftUIView(text: "Integration Three"))
addChild(swiftUIController)
swiftUIController.view.translatesAutoresizingMaskIntoConstraints
...