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
| // | |
| // HelloWorldApp.swift | |
| // HelloWorld | |
| // | |
| // Created by Zheng on 6/22/20. | |
| // | |
| import SwiftUI | |
| @main |
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
| struct ContentView: View { | |
| var body: some View { | |
| Text("Hello world!").padding() | |
| } | |
| } |
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
| class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
| ... | |
| lots more code | |
| ... | |
| func sceneDidBecomeActive(_ scene: UIScene) { | |
| // Called when the scene has moved from an inactive state to an active state. | |
| // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. | |
| print("scene is now active!") | |
| } | |
| func sceneWillResignActive(_ scene: UIScene) { |
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
| @main | |
| struct HelloWorldApp: App { | |
| @Environment(\.scenePhase) private var scenePhase | |
| var body: some Scene { | |
| WindowGroup { | |
| ContentView() | |
| } | |
| .onChange(of: scenePhase) { (newScenePhase) in | |
| switch newScenePhase { | |
| case .active: |
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
| // | |
| // HelloWorldApp.swift | |
| // HelloWorld | |
| // | |
| // Created by Zheng on 6/22/20. | |
| // | |
| import SwiftUI | |
| @main |
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
| import SwiftUI | |
| struct ContentView: View { | |
| @Binding var cameFromUrl: URL | |
| var body: some View { | |
| Text("Hello World! Came from url: \(cameFromUrl)") | |
| } | |
| } |
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
| import SwiftUI | |
| struct ContentView: View { | |
| @Binding var cameFromUrl: URL | |
| @State var orientation = UIDevice.current.orientation | |
| let orientationChanged = NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification) | |
| .makeConnectable() | |
| .autoconnect() | |
| var body: some View { |
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
| struct ContentView: View { | |
| var body: some View { | |
| let symbol = Image(systemName: "books.vertical") | |
| return Text("Here is a symbol \(symbol) embedded in a string!") | |
| } | |
| } |
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
| import SwiftUI | |
| class AppDelegate: NSObject, UIApplicationDelegate { | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | |
| if let shortcutItem = launchOptions?[UIApplication.LaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem { | |
| if shortcutItem.type == "com.example.ExampleApp.exampleAction" { | |
| print("Action Pressed!") | |
| } | |
| } | |
| return true |
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
| import SwiftUI | |
| class AppDelegate: NSObject, UIApplicationDelegate { | |
| @Published var shortcutItemType: String? | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | |
| if let shortcutItem = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem { | |
| if shortcutItem.type == "com.example.ExampleApp.exampleAction" { | |
| shortcutItemType = shortcutItem.type | |
| } | |
| } | |
| return true |