ios lifecycle swift 5.4 code example

Example: ios lifecycle swift 5.4

Xcode v12.4 (12D4e)
Swift 5

Application life cycle:

Files:
AppDelegate.swift
SceneDelegate.swift
ViewController.swift


@App launches:
AppDelegate::didFinishLaunchingWithOptions
Scene::willConnectTo()
Scene::willEnterForeground () ---> access saved state 
Scene::didBecomeActive()
ViewController::viewDidLoad()
ViewController::viewWillAppear()
ViewController::viewDidAppear()

@App goes to background:
Scene::willResignActive()
Scene::didEnterBackground () ---> save app state here

@App gets destroyed
Scene::didDisconnect()
AppDelegate::didDiscardSceneSession()
.