@@ -11,55 +11,32 @@ import SlideKit
11
11
@main
12
12
struct SlideKitDemo_macOSApp : App {
13
13
14
- /// Please edit the default value to the size you want
15
- let slideSize = SlideSize . standard16_9
16
-
17
- /// Please add your slide into the trailing closure
18
- let slideIndexController = SlideIndexController {
19
- BasicSlide ( )
20
- CustomHeaderStyleSlide ( )
14
+ /// Edit slide configurations in SlideConfiguration.swift
15
+ private static let configuration = SlideConfiguration ( )
16
+
17
+ /// A presentation content view.
18
+ /// Edit the view if you'd like to set environment, overlay view or background view here.
19
+ var presentationContentView : some View {
20
+ SlideRouterView ( slideIndexController: Self . configuration. slideIndexController)
21
+ . background ( . white)
21
22
}
22
23
23
24
var body : some Scene {
24
25
WindowGroup {
25
- PresentationView ( slideSize: slideSize) {
26
- SlideRouterView ( slideIndexController: slideIndexController)
27
- . background ( . white)
28
- }
29
- }
30
- . windowStyle ( . hiddenTitleBar)
31
- . commands {
32
- CommandGroup ( after: . undoRedo) {
33
- forwardButton ( . rightArrow)
34
- forwardButton ( . return)
35
- backButton ( . leftArrow)
36
- }
37
-
38
- CommandGroup ( after: . windowList) {
39
- Button ( " Open Presenter Window " ) { NSWorkspace . shared. open ( URL ( string: " slide://editor " ) !) }
40
- . keyboardShortcut ( " p " , modifiers: . command)
26
+ PresentationView ( slideSize: Self . configuration. size) {
27
+ presentationContentView
41
28
}
42
29
}
30
+ . setupAsPresentationWindow ( Self . configuration. slideIndexController, appName: " slide " )
43
31
44
32
WindowGroup {
45
- macOSPresenterView ( slideSize: slideSize, slideIndexController: slideIndexController) {
46
- SlideRouterView ( slideIndexController: slideIndexController)
47
- . background ( . white)
33
+ macOSPresenterView (
34
+ slideSize: Self . configuration. size,
35
+ slideIndexController: Self . configuration. slideIndexController
36
+ ) {
37
+ presentationContentView
48
38
}
49
39
}
50
- . handlesExternalEvents ( matching: [ " editor " ] )
51
- }
52
- }
53
-
54
- extension SlideKitDemo_macOSApp {
55
-
56
- private func forwardButton( _ key: KeyEquivalent ) -> some View {
57
- Button ( " forward " ) { slideIndexController. forward ( ) }
58
- . keyboardShortcut ( key, modifiers: [ ] )
59
- }
60
-
61
- private func backButton( _ key: KeyEquivalent ) -> some View {
62
- Button ( " back " ) { slideIndexController. back ( ) }
63
- . keyboardShortcut ( key, modifiers: [ ] )
40
+ . setupAsPresenterWindow ( )
64
41
}
65
42
}
0 commit comments