Skip to content

Instantly share code, notes, and snippets.

@paulocoutinhox
Last active October 7, 2023 17:39
Show Gist options
  • Save paulocoutinhox/c40ca4a162a66d0e03d485e465a8b8aa to your computer and use it in GitHub Desktop.
Save paulocoutinhox/c40ca4a162a66d0e03d485e465a8b8aa to your computer and use it in GitHub Desktop.
iOS - Código para rodar sem Main.Storyboard
@UIApplicationMain //or @main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow()
window?.rootViewController = RootViewController()
window?.makeKeyAndVisible()
return true
}
}
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
window.rootViewController = RootViewController()
self.window = window
window.makeKeyAndVisible()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment