feat: 初始化 iOS 远程控制端项目
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
/// 场景代理:以 UIHostingController 承载 SwiftUI 根视图(UIKit 与 SwiftUI 混用)
|
||||
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func scene(_ scene: UIScene,
|
||||
willConnectTo session: UISceneSession,
|
||||
options connectionOptions: UIScene.ConnectionOptions) {
|
||||
guard let windowScene = scene as? UIWindowScene else { return }
|
||||
|
||||
let window = UIWindow(windowScene: windowScene)
|
||||
let hosting = UIHostingController(rootView: ContentView())
|
||||
hosting.view.backgroundColor = .black
|
||||
window.rootViewController = hosting
|
||||
window.makeKeyAndVisible()
|
||||
self.window = window
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user