ScenePreferenceValues.swift 523 B

12345678910111213141516
  1. /// A scene's preferences. Propagated up the scene hierarchy automatically.
  2. public struct ScenePreferenceValues {
  3. /// The default preferences.
  4. public static var `default`: ScenePreferenceValues {
  5. ScenePreferenceValues(commands: .empty)
  6. }
  7. /// The commands to be shown by the app.
  8. public var commands: Commands
  9. }
  10. extension ScenePreferenceValues {
  11. init(merging children: [ScenePreferenceValues]) {
  12. commands = children.map(\.commands).reduce(.empty) { $0.overlayed(with: $1) }
  13. }
  14. }