File tree Expand file tree Collapse file tree 1 file changed +41
-2
lines changed
Example/InterposeKitExample/Sources Expand file tree Collapse file tree 1 file changed +41
-2
lines changed Original file line number Diff line number Diff line change 11import AppKit
2+ import SwiftUI
23
34@main
45class AppDelegate : NSObject , NSApplicationDelegate {
6+
7+ private lazy var window : NSWindow = {
8+ let window = NSWindow (
9+ contentRect: . zero,
10+ styleMask: [ . titled, . closable, . miniaturizable] ,
11+ backing: . buffered,
12+ defer: false
13+ )
14+
15+ window. title = " InterposeKit Example "
16+ window. contentViewController = self . hostingController
17+
18+ return window
19+ } ( )
20+
21+ private lazy var hostingController : NSViewController = {
22+ return NSHostingController ( rootView: ContentView ( ) )
23+ } ( )
24+
25+ func applicationDidFinishLaunching( _ notification: Notification ) {
26+ Task { @MainActor in
27+ self . window. center ( )
28+ self . window. makeKeyAndOrderFront ( nil )
29+ }
30+ }
31+
32+ func applicationShouldTerminateAfterLastWindowClosed(
33+ _ sender: NSApplication
34+ ) -> Bool {
35+ return true
36+ }
37+
38+ }
539
6- func applicationDidFinishLaunching( _ notification: Notification ) { }
7-
40+ fileprivate struct ContentView : View {
41+ fileprivate var body : some View {
42+ Text ( " Hello from InterposeKit! " )
43+ . font ( . title)
44+ . fixedSize ( )
45+ . padding ( 200 )
46+ }
847}
You can’t perform that action at this time.
0 commit comments