Migrating existing SwiftUI apps to the new multi platform template

I have an iOS 13 app that I’m hoping to release soon that is written entirely in SwiftUI. If I was starting from scratch today, I’d obviously use the new multi platform template which looks awesome.... But since I’m not starting from scratch, what are the recommendations/best practices for existing apps?

Is there a path for migrating existing apps to take advantage of the new app structure (below) when moving to iOS 14?

Code Block
@main
struct HelloWorld: App {
var body: some Scene {
WindowGroup {
Text(“Hello, world!”).padding()
}
}
}

There's not a direct path since every app will have different needs. For instance, some apps could easily switch if their UI was already encapsulated in a SwiftUI view hierarchy, which can now be the Content of the main WindowGroup, and if their app's model was already able to be expressed as an ObservableObject, which can be transitioned to a @StateObject on the App. There's also new tools like @SceneStorage for transitioning scene-wide state restoration and @AppStorage for transitioning user defaults / prefs. The Data Essentials in SwiftUI talk will have more details on those and how they fit into an app!

For migration, there might be existing app/scene delegate logic that doesn't yet have a first class SwiftUI API — and similar to UIViewRepresentable, there is @UIApplicationDelegateAdaptor as a property wrapper that can be used in an App to allow it to receive callbacks from your SwiftUI app.

In case anyone comes across this looking for help with migration, take a look at this article: Migrating to the SwiftUI life cycle

Migrating existing SwiftUI apps to the new multi platform template
 
 
Q