Skip to content

Instantly share code, notes, and snippets.

@ycui1
Created January 5, 2020 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ycui1/68b2e008dbc06061ad7f293a6525e6c6 to your computer and use it in GitHub Desktop.
Save ycui1/68b2e008dbc06061ad7f293a6525e6c6 to your computer and use it in GitHub Desktop.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let contentView = ContentView()
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
if let shortcutItem = connectionOptions.shortcutItem {
let alertController = UIAlertController(title: "ActionSheet", message: "Launched with \(shortcutItem.type)", preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: nil))
window?.rootViewController?.present(alertController, animated: true, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment