[UIKit] SwiftUI Preview 맛보기
2022. 8. 14. 20:32ㆍiOS/UIKit
728x90
반응형
#if DEBUG
import SwiftUI
struct ViewControllerRepresentable: UIViewControllerRepresentable {
func updateUIViewController(_ uiView: UIViewController,context: Context) {
// leave this empty
}
@available(iOS 13.0.0, *)
func makeUIViewController(context: Context) -> UIViewController{
HomeVC()
}
}
@available(iOS 13.0, *)
struct ViewControllerRepresentable_PreviewProvider: PreviewProvider {
static var previews: some View {
Group {
ViewControllerRepresentable()
.ignoresSafeArea()
.previewDisplayName(/*@START_MENU_TOKEN@*/"Preview"/*@END_MENU_TOKEN@*/)
.previewDevice(PreviewDevice(rawValue: "iPhone 11"))
}
}
} #endif
뷰컨트롤러 맨밑에 작성하고
[option] + [command] + p
728x90
반응형
'iOS > UIKit' 카테고리의 다른 글
[UIKit] 카카오 (다음) 지도 API 마커추가하기 (0) | 2022.08.31 |
---|---|
[UIKit] Snapkit(스냅킷) 테이블뷰셀 오토레이아웃 (라벨길이에 따른 가변적 높이 설정) (0) | 2022.08.25 |
[UIKit] 스토리보드 없는 프로젝트 세팅 (0) | 2022.08.14 |
[UIKit] 카카오 (다음) 지도 API 사용하기(2) (0) | 2022.08.14 |
[UIKit] 카카오 (다음) 지도 API 사용하기 (0) | 2022.08.14 |