Slide 35
Slide 35 text
35
SwiftUIΛΈࠐΉίʔυ
// HomeContainerView: SwiftUIͰ࡞ͨ͠ը໘
let homeContainerVC = UIHostingController(rootView: HomeContainerView())
guard let homeContainerView = homeContainerVC.view else { return }
self.addChild(homeContainerVC)
homeContainerVC.didMove(toParent: self)
self.view.addSubview(homeContainerView)
// Auto Layout੍Λઃఆ
homeContainerView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
homeContainerView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant:
0.0),
homeContainerView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor, constant:
0.0),
homeContainerView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 0.0),
homeContainerView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: 0.0)
])