Created
March 15, 2024 13:43
-
-
Save Myrrel/0d7118c5b0f5a2655a8cf47378590286 to your computer and use it in GitHub Desktop.
SceneDelegate-SwiftUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SwiftUI | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use a UIHostingController as window root view controller | |
if let windowScene = scene as? UIWindowScene { | |
let window = UIWindow(windowScene: windowScene) | |
window.rootViewController = UIHostingController(rootView: ContentView()) | |
self.window = window | |
window.makeKeyAndVisible() | |
} | |
} | |
func sceneDidDisconnect(_ scene: UIScene) {} | |
func sceneDidBecomeActive(_ scene: UIScene) {} | |
func sceneWillResignActive(_ scene: UIScene) {} | |
func sceneWillEnterForeground(_ scene: UIScene) {} | |
func sceneDidEnterBackground(_ scene: UIScene) {} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment