-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathSceneNodeUpdateResult.swift
More file actions
21 lines (18 loc) · 829 Bytes
/
SceneNodeUpdateResult.swift
File metadata and controls
21 lines (18 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/// The result of updating a scene graph node.
public struct SceneNodeUpdateResult: Sendable {
/// The preference values produced by the scene and its children.
public var preferences: ScenePreferenceValues
public init(preferences: ScenePreferenceValues) {
self.preferences = preferences
}
/// Creates an update result by combining the preference values of a scene's
/// children.
public init(childResults: [SceneNodeUpdateResult]) {
preferences = ScenePreferenceValues(merging: childResults.map(\.preferences))
}
/// Creates the layout result of a leaf scene (one with no children and no
/// special preference behaviour). Uses ``ScenePreferenceValues/default``.
public static func leafScene() -> Self {
SceneNodeUpdateResult(preferences: .default)
}
}