Browse Source

Now AppDelegate is main point to start app

Sergey 2 years ago
parent
commit
d45b042394
2 changed files with 12 additions and 1 deletions
  1. 12 0
      Chat/Main/AppDelegate.swift
  2. 0 1
      Chat/Main/ChatApp.swift

+ 12 - 0
Chat/Main/AppDelegate.swift

@@ -6,14 +6,26 @@
 //
 
 import UIKit
+import SwiftUI
 import XMPPFramework
 
+@main
 class AppDelegate: UIResponder, UIApplicationDelegate {
+	
+	var window: UIWindow?
+
 	func application(
 		_ application: UIApplication,
 		didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
 	) -> Bool {
+
+		window = UIWindow(frame: UIScreen.main.bounds)
+		window?.rootViewController = UIHostingController(rootView: ContentView())
+		window?.makeKeyAndVisible()
+
 		DDLog.add(DDOSLogger.sharedInstance, with: DDLogLevel.all)
+
 		return true
 	}
+
 }

+ 0 - 1
Chat/Main/ChatApp.swift

@@ -8,7 +8,6 @@
 import SwiftUI
 import XMPPFramework
 
-@main
 struct ChatApp: App {
     @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate