SceneDelegate.swift 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SceneDelegate.swift
  2. // Tencent is pleased to support the open source community by making vap available.
  3. //
  4. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  5. //
  6. // Licensed under the MIT License (the "License"); you may not use this file except in
  7. // compliance with the License. You may obtain a copy of the License at
  8. //
  9. // http://opensource.org/licenses/MIT
  10. //
  11. // Unless required by applicable law or agreed to in writing, software distributed under the License is
  12. // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  13. // either express or implied. See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. import UIKit
  16. class SceneDelegate: UIResponder, UIWindowSceneDelegate {
  17. var window: UIWindow?
  18. func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  19. // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
  20. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
  21. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
  22. guard let _ = (scene as? UIWindowScene) else { return }
  23. }
  24. func sceneDidDisconnect(_ scene: UIScene) {
  25. // Called as the scene is being released by the system.
  26. // This occurs shortly after the scene enters the background, or when its session is discarded.
  27. // Release any resources associated with this scene that can be re-created the next time the scene connects.
  28. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  29. }
  30. func sceneDidBecomeActive(_ scene: UIScene) {
  31. // Called when the scene has moved from an inactive state to an active state.
  32. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  33. }
  34. func sceneWillResignActive(_ scene: UIScene) {
  35. // Called when the scene will move from an active state to an inactive state.
  36. // This may occur due to temporary interruptions (ex. an incoming phone call).
  37. }
  38. func sceneWillEnterForeground(_ scene: UIScene) {
  39. // Called as the scene transitions from the background to the foreground.
  40. // Use this method to undo the changes made on entering the background.
  41. }
  42. func sceneDidEnterBackground(_ scene: UIScene) {
  43. // Called as the scene transitions from the foreground to the background.
  44. // Use this method to save data, release shared resources, and store enough scene-specific state information
  45. // to restore the scene back to its current state.
  46. }
  47. }