Sign In
한결
Status
Empty
Assignee
Empty
UIKit 프로젝트에서 SwiftUI 코드로 작성한 화면을 띄우는 방법
iOS13+ 버전에서 활용할 수 있는 UIHostingController를 통해서 some View를 반환하는 구조체 인스턴스를 넣어준다.
UIHostingController는 기본적으로 UIViewController를 상속받고, View 프로토콜을 따르는 객체를 반환하는 인스턴스를 제네릭 타입으로 가진다.
let vc = UIHostingController(rootView: ContentView1()) present(vc, animated: true)
👍