SwiftUI 에서도 UIKit 에서 제공하는 AppDelegate 기능을 사용할 수 있습니다.

 

UIApplicationDelegate

import UIkit

class CustomAppDelegate: NSObject, UIApplicationDelegate {
   func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
      // 수행할 작업내용
      return true
   }
}

 

UIWindowSceneDelegate

import UIKit

class CustomSceneDelegate: NSObject, UIWindowSceneDelegate {
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        print("Scene was created")
    }
}

 

'SwiftUI' 카테고리의 다른 글

Web Links - 웹 링크 연동시키기  (0) 2024.01.17
addingPercentEncoding - 특수 기호 URL에 포함시키기  (0) 2024.01.17
User Notification 알림 표시하기  (0) 2024.01.16
System Notifications  (0) 2024.01.15
TapGesture  (0) 2024.01.06
ytw_developer