Skip to content

Commit dfd4b90

Browse files
committed
Add LegacyApp
1 parent 75efab0 commit dfd4b90

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// LegacyApp.swift
3+
// OpenSwiftUI
4+
//
5+
// Created by Kyle on 2024/1/9.
6+
// Lastest Version: iOS 15.5
7+
// Status: Complete
8+
// ID: F8F4CFB3FB453F4ECC15C05B76BCD1E4
9+
10+
public enum __App {}
11+
12+
extension __App {
13+
public static func run(_ rootView: some View) -> Never {
14+
runApp(ShoeboxAdaptor(rootView: rootView))
15+
}
16+
}
17+
18+
extension __App {
19+
private struct ShoeboxAdaptor<V: View>: App {
20+
var rootView: V
21+
22+
init() {
23+
fatalError("Not a standalone App.")
24+
}
25+
26+
init(rootView: V) {
27+
self.rootView = rootView
28+
}
29+
30+
var body: some Scene {
31+
WindowGroup { rootView }
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)