SwiftUI For Dummies. Wei-Meng Lee. Читать онлайн. Newlib. NEWLIB.NET

Автор: Wei-Meng Lee
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Программы
Год издания: 0
isbn: 9781119652700
Скачать книгу
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).

      SceneDelegate.swift

      Whereas the AppDelegate.swift file is responsible for handling your app life cycle, the SceneDelegate.swift file is responsible for your scene's life cycle.

      The SceneDelegate.swift file contains the following default functions:

       scene(_:willConnectTo:options:)

       sceneDidDisconnect(_:)

       sceneDidBecomeActive(_:)

       sceneWillResignActive(_:)

       sceneWillEnterForeground(_:)

       sceneDidEnterBackground(_:)

       func scene(_ scene: UIScene, willConnectTo session:

       UISceneSession, options connectionOptions:

       UIScene.ConnectionOptions) {

      

       let contentView = ContentView()

       if let windowScene = scene as? UIWindowScene {

       let window = UIWindow(windowScene:

       windowScene)

       window.rootViewController =

       UIHostingController(rootView: contentView)

       self.window = window

       window.makeKeyAndVisible()

       }

       }

      In short, you use AppDelegate.swift to perform setup needed for the duration of the app. You also use it to handle events that focus on the app, as well as registered for external services like push notifications. The SceneDelegate.swift, on the other hand, is designed to handle events for multi-window OS (iPadOS), which supports multiple instances of your app’s UI.

      Конец ознакомительного фрагмента.

      Текст предоставлен ООО «ЛитРес».

      Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.

      Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.

/9j/4AAQSkZJRgABAQEBLAEsAAD/7SeUUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAABccAVoAAxsl RxwBWgADGyVHHAIAAAIAAAA4QklNBCUAAAAAABDHXRfldLVu9du+OZTA6XlcOEJJTQQ6AAAAAADl AAAAEAAAAAEAAAAAAAtwcmludE91dHB1dAAAAAUAAAAAUHN0U2Jvb2wBAAAAAEludGVlbnVtAAAA AEludGUAAAAAQ2xybQAAAA9wcmludFNpeHRlZW5CaXRib29sAAAAAAtwcmludGVyTmFtZVRFWFQA AAABAAAAAAAPcHJpbnRQcm9vZlNldHVwT2JqYwAAAAwAUAByAG8AbwBmACAAUwBlAHQAdQBwAAAA AAAKcHJvb2ZTZXR1cAAAAAEAAAAAQmx0bmVudW0AAAAMYnVpbHRpblByb29mAAAACXByb29mQ01Z SwA4QklNBDsAAAAAAi0AAAAQAAAAAQAAAAAAEnByaW50T3V0cHV0T3B0aW9ucwAAABcAAAAAQ3B0 bmJvb2wAAAAAAENsYnJib29sAAAAAABSZ3NNYm9vbAAAAAAAQ3JuQ2Jvb2wAAAAAAENudENib29s AAAAAABMYmxzYm9vbAAAAAAATmd0dmJvb2wAAAAAAEVtbERib29sAAAAAABJbnRyYm9vbAAAAAAA QmNrZ09iamMAAAABAAAAAAAAUkdCQwAAAAMAAAAAUmQgIGRvdWJAb+AAAAAAAAAAAABHcm4gZG91 YkBv4AAAAAAAAAAAAEJsICBkb3ViQG/gAAAAAAAAAAAAQnJkVFVudEYjUmx0AAAAAAAA