Читать книгу SwiftUI For Dummies - Wei-Meng Lee - Страница 19

AppDelegate.swift

Оглавление

AppDelegate.swift is the place where you write code to handle an application's launch, going into the background, coming to the foreground, and other activities.

AppDelegate.swift has three main functions:

 application(:didFinishLaunchingWithOptions) -> Bool: This function is called when the application is launched. You can use this function to perform your setup for the app when it's launched.

 application(: configurationForConnecting:options:) -> UISceneConfiguration: This function is called whenever your app is needed to supply a new scene. Here, it returns the default item in the dictionary named Default Configuration: 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)} A scene is an object that represents one instance of your app's user interface.

 application(:didDiscardSceneSessions:): This function is called whenever a user discards a scene (such as swiping it away in the multitasking window).

SwiftUI For Dummies

Подняться наверх