Last active
August 27, 2024 17:16
-
-
Save douglashill/b8125f7e2336b6a47461df0d4898f64d to your computer and use it in GitHub Desktop.
A minimal iOS UIKit app set up entirely in code rather than using a storyboard and UIApplicationSceneManifest in the Info.plist.
This file contains hidden or 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
// A minimal iOS UIKit app set up entirely in code rather than using a storyboard and UIApplicationSceneManifest in the Info.plist. | |
// Last updated for iOS 18. | |
import UIKit | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
private var _window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
let window = UIWindow(windowScene: scene as! UIWindowScene) | |
window.rootViewController = UIViewController() | |
window.makeKeyAndVisible() | |
_window = window | |
} | |
} | |
@main class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | |
let configuration = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) | |
configuration.delegateClass = SceneDelegate.self | |
return configuration | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment