Skip to content

Commit

Permalink
generate scene for the user
Browse files Browse the repository at this point in the history
  • Loading branch information
AdinAck committed Jul 17, 2024
1 parent 08991fe commit 7d13d44
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
24 changes: 3 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,13 @@ import PresentationKit

@main
struct MyApp: App {
@StateObject var model = Presentation(bgColor: .white, slides: [
@StateObject var presentation = Presentation(bgColor: .white, slides: [
Title(),
// put more slides here
])

var body: some Scene {
WindowGroup {
PresentationView()
.environmentObject(model)
}
.commands {
CommandMenu("Control") {
Text("Current frame: \(Int(model.keyframe))")

Button("Next Keyframe") {
model.nextKeyframe()
}
.keyboardShortcut("N")

Button("Previous Keyframe") {
model.prevKeyFrame()
}
.keyboardShortcut("B")
}
}
PresentationScene(presentation: presentation)
}
}
```
Expand Down
35 changes: 35 additions & 0 deletions Sources/Presentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,38 @@ public struct PresentationView: View {
}
}
}

public struct PresentationScene: Scene {
let presentation: Presentation

public init(presentation: Presentation) {
self.presentation = presentation
}

public var body: some Scene {
Window("Presentation", id: "presentation") {
PresentationView()
.environmentObject(presentation)
}
.commands {
CommandMenu("Control") {
Text("Current frame: \(Int(presentation.keyframe))")

Button("Next Keyframe") {
presentation.nextKeyframe()
}
.keyboardShortcut("N")

Button("Previous Keyframe") {
presentation.prevKeyFrame()
}
.keyboardShortcut("B")
}
}

Window("Teleprompter", id: "teleprompter") {
TeleprompterView()
.environmentObject(presentation)
}
}
}

0 comments on commit 7d13d44

Please sign in to comment.