To this: UIApplicationSceneManifest UIApplicationSupportsMultipleScenes UISceneConfigurations UIWindowSceneSessionRoleApplication UISceneConfigurationName Default Configuration UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate From this: UIApplicationSceneManifest UIApplicationSupportsMultipleScenes If you're like me and like to work with text files instead of GUIs, you can edit the ist directly. Got in your app target "Info" section and update the "Application Scene Manifest" from this: Step 3 - Update ist UIApplicationSceneManifest & a UIApplicationDelegate and UIWindowSceneDelegate in place, it's finally time to tell Xcode to use them for the app's life cycle. We'll take care of this in the next step. Like AppDelegate, this code is currently unused.
Window.rootViewController = UIHostingController(rootView: rootView) Let window = UIWindow(windowScene: windowScene) Step 0 - Extract root view from SwiftUI AppĪll the layout configuration from your SwiftUI App will be lost once UIKit manages the life cycle.īefore we begin, extract your current root view in a dedicated View, so you'll have all your existing UI ready to go after the conversion.įor example, let's say your App looks like this: struct ExampleApp: App
The commits history shows the diff for each step. You can find the sample project for this tutorial on GitHub. Still, the process is straightforward – once you know which files to update.
Unfortunately, there is no Xcode wizard to do this.
#USE APPDELETE TO TRANSFER PROGRAMS HOW TO#
This brief tutorial shows how to convert a SwiftUI app from the SwiftUI to the UIKit App Delegate life cycle in Xcode.