If you create your app without using Storyboard in UIKit. You probably have to run your app every time to see your app design.
Now, You don’t do that way, because there is a simple way that I’m going to show you in this article.
Create your project
import UIKit
import SwiftUIclass RedViewController: UIViewController { override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
}
}
Create representable view “RedViewIntegratedController"
struct RedViewIntegratedController: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> UIViewController {
LaunchScreenVC()
} func updateUIViewController(_ uiViewController: UIViewController, context: Context) { } typealias UIViewControllerType = UIViewController
}
Create “ContentView “and “ContentView_Preview”
struct ContentView: View { var body: some View {
RedViewIntegratedController().edgesIgnoringSafeArea(.all)
}
}struct ContentView_Preview: PreviewProvider {
static var previews: some View {
ContentView()
}
}
now, you can see your UI design in real-time.