是否可以将AppDelegate添加到独立的watchOS SwiftUI应用程序?

问题描述

我正在尝试将AppDelegate添加到独立的watchOS SwiftUI应用(无配套的iOS应用)中,如here中所示,但我似乎无法解决问题 找不到类型范围内的“ UIApplicationDelegate”

明确添加导入UIKit没有帮助。

有任何线索吗?

解决方法

https://developer.apple.com/documentation/uikit/uiapplicationdelegate

UIApplicationDelegate似乎仅适用于Catalyst,iOS和TvOS。根据WatchKit文档,它使用具有所有相同方法的WKExtensionDelegate

https://developer.apple.com/documentation/watchkit/working_with_the_watchos_app_life_cycle

https://developer.apple.com/documentation/watchkit/wkextensiondelegate