Posts

Showing posts from February, 2020

Use SwiftUI preview with UIKit

Image
In my opinion SwiftUI preview is the most useful feature in SwiftUI if you want to work with older version of IOS. In this post I share how I set up my project.  Create project like showing in the pictures:   Delete the unused ContentView which use the SwiftUI.   Modify AppDelegate as follow. Create MainView (UIView) and MainViewController (UIViewController). Adding these previews functions into MainView and MainViewController. Build the project and refresh Canvas. The previews should show now. You can try to change a background color of the ViewController and see the change take effect immediately. Like in the video: Finally, Link to the code. - ninjahoahong