From c3fc42d7246ff4b0c294e1259ef6d4748e23a29e Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 11 Apr 2023 18:11:57 +0200 Subject: [PATCH] Removed the SceneDelegate delegate. --- Apps/Locations/Resources/Info.plist | 20 +------ Apps/Locations/Sources/AppDelegate.swift | 34 ++++------- Apps/Locations/Sources/SceneDelegate.swift | 67 ---------------------- DeepLinking.xcodeproj/project.pbxproj | 4 -- 4 files changed, 13 insertions(+), 112 deletions(-) delete mode 100644 Apps/Locations/Sources/SceneDelegate.swift diff --git a/Apps/Locations/Resources/Info.plist b/Apps/Locations/Resources/Info.plist index 0eb786d..0c67376 100644 --- a/Apps/Locations/Resources/Info.plist +++ b/Apps/Locations/Resources/Info.plist @@ -1,23 +1,5 @@ - - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - UISceneConfigurations - - UIWindowSceneSessionRoleApplication - - - UISceneConfigurationName - Default Configuration - UISceneDelegateClassName - $(PRODUCT_MODULE_NAME).SceneDelegate - - - - - + diff --git a/Apps/Locations/Sources/AppDelegate.swift b/Apps/Locations/Sources/AppDelegate.swift index b40c8ba..974d077 100644 --- a/Apps/Locations/Sources/AppDelegate.swift +++ b/Apps/Locations/Sources/AppDelegate.swift @@ -11,35 +11,25 @@ import CoreData @main class AppDelegate: UIResponder, UIApplicationDelegate { + + // MARK: Properties + + var window: UIWindow? = .init(frame: UIScreen.main.bounds) + + // MARK: UIApplicationDelegate func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - // Override point for customization after application launch. + window?.rootViewController = ViewController() + window?.makeKeyAndVisible() + return true } - - // MARK: UISceneSession Lifecycle - - func application( - _ application: UIApplication, - configurationForConnecting connectingSceneSession: UISceneSession, - options: UIScene.ConnectionOptions - ) -> UISceneConfiguration { - // Called when a new scene session is being created. - // Use this method to select a configuration to create the new scene with. - return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) - } - - func application( - _ application: UIApplication, - didDiscardSceneSessions sceneSessions: Set - ) { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + + func applicationDidEnterBackground(_ application: UIApplication) { + // Save changes in the application's managed object context when the application transitions to the background. } } - diff --git a/Apps/Locations/Sources/SceneDelegate.swift b/Apps/Locations/Sources/SceneDelegate.swift deleted file mode 100644 index c95cee8..0000000 --- a/Apps/Locations/Sources/SceneDelegate.swift +++ /dev/null @@ -1,67 +0,0 @@ -// -// SceneDelegate.swift -// Locations -// -// Created by Javier Cicchelli on 08/04/2023. -// Copyright © 2023 Röck+Cöde. 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 windowScene = scene as? UIWindowScene else { - return - } - - window = { - let window = UIWindow(windowScene: windowScene) - - window.rootViewController = ViewController() - window.makeKeyAndVisible() - - return window - }() - } - - 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 necessarily 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. - - // Save changes in the application's managed object context when the application transitions to the background. - } - -} diff --git a/DeepLinking.xcodeproj/project.pbxproj b/DeepLinking.xcodeproj/project.pbxproj index 6181e6f..99dee7a 100644 --- a/DeepLinking.xcodeproj/project.pbxproj +++ b/DeepLinking.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 46EB331B29E1CE04001D5EAF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EB331A29E1CE04001D5EAF /* AppDelegate.swift */; }; - 46EB331D29E1CE04001D5EAF /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EB331C29E1CE04001D5EAF /* SceneDelegate.swift */; }; 46EB331F29E1CE04001D5EAF /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EB331E29E1CE04001D5EAF /* ViewController.swift */; }; 46EB332729E1CE05001D5EAF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 46EB332629E1CE05001D5EAF /* Assets.xcassets */; }; 46EB332A29E1CE05001D5EAF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 46EB332829E1CE05001D5EAF /* LaunchScreen.storyboard */; }; @@ -114,7 +113,6 @@ 46EB325829E1BD5C001D5EAF /* Wikipedia.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Wikipedia.xcodeproj; path = Wikipedia/Wikipedia.xcodeproj; sourceTree = ""; }; 46EB331829E1CE04001D5EAF /* Locations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Locations.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46EB331A29E1CE04001D5EAF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 46EB331C29E1CE04001D5EAF /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 46EB331E29E1CE04001D5EAF /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 46EB332629E1CE05001D5EAF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46EB332929E1CE05001D5EAF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -200,7 +198,6 @@ isa = PBXGroup; children = ( 46EB331A29E1CE04001D5EAF /* AppDelegate.swift */, - 46EB331C29E1CE04001D5EAF /* SceneDelegate.swift */, 46EB331E29E1CE04001D5EAF /* ViewController.swift */, ); path = Sources; @@ -409,7 +406,6 @@ files = ( 46EB331F29E1CE04001D5EAF /* ViewController.swift in Sources */, 46EB331B29E1CE04001D5EAF /* AppDelegate.swift in Sources */, - 46EB331D29E1CE04001D5EAF /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };