title: How to convert from UIKit life cycle to SwiftUI life cycle in iOS 14 (Xcode 12 Beta)
body: <p>I am currently working on SwiftUI app in which I am using <code>SceneDelegate</code> and <code>AppDelegate</code>. I would like to know how I can convert the life cycle from <code>UIKit</code> to <code>SwiftUI</code> one where there is an <code>App</code> struct and with <code>scenes</code> etc.</p>
  <p>Also I would like to know how to cater for CoreData and PersistentContainers and inject these into our environments.</p>
  <p>Also I have used <code>UIApplicationDelegateAdapter</code> to inject <code>AppDelegate</code> but the <code>@main</code> is giving me error</p>
  <blockquote>
  <p>'main()' is only available in iOS 14.0 or newer</p>
  </blockquote>
  <p>I am using <code>@available (iOS 14.0, *)</code> in the beginning:</p>
  <pre><code>import SwiftUI
  
  @available(iOS 14.0, *)
  @main
  
  struct MyApp: App {
  
      @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
      let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
      
      var body: some Scene {
          WindowGroup {
              ContentView()
          }
      }
  }
  </code></pre>
  <p>Doing it like this, where does the <code>SceneDelegate</code> code goes. I am still quite confused how this conversion goes. I have not seen Apple talking about this in their sessions or anything. Help will be really appreciated.</p>