-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDestinationVideo.swift
46 lines (40 loc) · 1.35 KB
/
DestinationVideo.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
See the LICENSE.txt file for this sample’s licensing information.
Abstract:
The main app structure.
*/
import SwiftUI
import os
@main
struct DestinationVideo: App {
/// An object that controls the video playback behavior.
@State private var player = PlayerModel()
/// An object that manages the library of video content.
@State private var library = VideoLibrary()
var body: some Scene {
// The app's primary content window.
WindowGroup {
ContentView()
.environment(player)
.environment(library)
#if !os(visionOS)
// Use a dark color scheme on supported platforms.
.preferredColorScheme(.dark)
.tint(.white)
#endif
}
#if os(visionOS)
// Defines an immersive space to present a destination in which to watch the video.
ImmersiveSpace(for: Destination.self) { $destination in
if let destination {
DestinationView(destination)
.environment(player)
}
}
// Set the immersion style to progressive, so the user can use the crown to dial in their experience.
.immersionStyle(selection: .constant(.progressive), in: .progressive)
#endif
}
}
/// A global logger for the app.
let logger = Logger()