summaryrefslogtreecommitdiff
path: root/Example Apps/Example Swift
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-11-08 13:38:24 -0500
committerJoel Fischer <joeljfischer@gmail.com>2019-11-08 13:38:24 -0500
commita9bea6f6554cc5e3d8a73d28870f8ae783d02700 (patch)
treefaff1b5f6796988d5b501d4b87e17ee2d6551c61 /Example Apps/Example Swift
parent8ee188990f23421d76437194dde386a14a2f5986 (diff)
downloadsdl_ios-a9bea6f6554cc5e3d8a73d28870f8ae783d02700.tar.gz
Create a separate lockscreen code path for iOS 13-based scene APIs
Diffstat (limited to 'Example Apps/Example Swift')
-rw-r--r--Example Apps/Example Swift/AppDelegate.swift22
-rw-r--r--Example Apps/Example Swift/SceneDelegate.swift48
-rw-r--r--Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist19
3 files changed, 69 insertions, 20 deletions
diff --git a/Example Apps/Example Swift/AppDelegate.swift b/Example Apps/Example Swift/AppDelegate.swift
index d602970c7..826537cb0 100644
--- a/Example Apps/Example Swift/AppDelegate.swift
+++ b/Example Apps/Example Swift/AppDelegate.swift
@@ -20,25 +20,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
- func applicationWillResignActive(_ application: UIApplication) {
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
- }
-
- func applicationDidEnterBackground(_ application: UIApplication) {
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- }
-
- func applicationWillEnterForeground(_ application: UIApplication) {
- // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
- }
-
- func applicationDidBecomeActive(_ application: UIApplication) {
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- }
-
- func applicationWillTerminate(_ application: UIApplication) {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+ func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
+ return UISceneConfiguration(name: "Default", sessionRole: connectingSceneSession.role)
}
}
diff --git a/Example Apps/Example Swift/SceneDelegate.swift b/Example Apps/Example Swift/SceneDelegate.swift
new file mode 100644
index 000000000..c06c1dec6
--- /dev/null
+++ b/Example Apps/Example Swift/SceneDelegate.swift
@@ -0,0 +1,48 @@
+//
+// SceneDelegate.swift
+// SmartDeviceLink-Example-Swift
+//
+// Created by Joel Fischer on 11/6/19.
+// Copyright © 2019 smartdevicelink. All rights reserved.
+//
+
+import UIKit
+
+class SceneDelegate: UIResponder, UIWindowSceneDelegate {
+ var window: UIWindow?
+
+ func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
+ // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
+ // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
+ // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
+ guard let _ = (scene as? UIWindowScene) else { return }
+ }
+
+ func sceneDidDisconnect(_ scene: UIScene) {
+ // Called as the scene is being released by the system.
+ // This occurs shortly after the scene enters the background, or when its session is discarded.
+ // Release any resources associated with this scene that can be re-created the next time the scene connects.
+ // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
+ }
+
+ 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.
+ }
+
+ func sceneWillResignActive(_ scene: UIScene) {
+ // Called when the scene will move from an active state to an inactive state.
+ // This may occur due to temporary interruptions (ex. an incoming phone call).
+ }
+
+ func sceneWillEnterForeground(_ scene: UIScene) {
+ // Called as the scene transitions from the background to the foreground.
+ // Use this method to undo the changes made on entering the background.
+ }
+
+ func sceneDidEnterBackground(_ scene: UIScene) {
+ // Called as the scene transitions from the foreground to the background.
+ // Use this method to save data, release shared resources, and store enough scene-specific state information
+ // to restore the scene back to its current state.
+ }
+}
diff --git a/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist b/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
index 9b5e3074e..5749315c6 100644
--- a/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
+++ b/Example Apps/Example Swift/SmartDeviceLink-Example-Swift-Info.plist
@@ -73,6 +73,25 @@
<string>com.ford.sync.prot0</string>
<string>com.smartdevicelink.multisession</string>
</array>
+ <key>UIApplicationSceneManifest</key>
+ <dict>
+ <key>UIApplicationSupportsMultipleScenes</key>
+ <true/>
+ <key>UISceneConfigurations</key>
+ <dict>
+ <key>UIWindowSceneSessionRoleApplication</key>
+ <array>
+ <dict>
+ <key>UISceneDelegateClassName</key>
+ <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
+ <key>UISceneConfigurationName</key>
+ <string>Default</string>
+ <key>UISceneStoryboardFile</key>
+ <string>Main</string>
+ </dict>
+ </array>
+ </dict>
+ </dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>