portico/Sources/Portico/App/Scene.swift

18 lines
806 B
Swift

/// A part of an application's user interface.
///
/// Scenes compose into the ``App/body-swift.property`` hierarchy.
/// ``ApplicationWindow`` is the primary concrete scene in v1.
@MainActor public protocol Scene {
/// The type of scene representing the body of this scene.
associatedtype Body: Scene
/// The content of the scene, composed using ``SceneBuilder``.
var body: Body { get }
}
/// Terminal conformance `Never` is the empty `Body` type that terminates
/// the `Scene` associated-type chain. `Never`'s `body` witness is supplied
/// by its `View` conformance (`View.swift`) and serves both protocols; a
/// single `body` member covers both, so it is deliberately NOT redeclared
/// here (a second declaration is an "invalid redeclaration" error).
extension Never: Scene {}