Files
TUIkit/Sources/TUIKit/App/Scene.swift
T
phranck 45e73faafb refactor: Rename package from SwiftTUI to TUIKit
BREAKING CHANGE: Package name changed due to name collision with
existing rensbreur/SwiftTUI package.

Changes:
- Rename package from SwiftTUI to TUIKit in Package.swift
- Rename Sources/SwiftTUI to Sources/TUIKit
- Rename Sources/SwiftTUIExample to Sources/TUIKitExample
- Rename Tests/SwiftTUITests to Tests/TUIKitTests
- Rename SwiftTUI.swift to TUIKit.swift
- Update all imports: import SwiftTUI -> import TUIKit
- Update all code references: SwiftTUI.renderToBuffer -> TUIKit.renderToBuffer
- Update documentation comments
- Rename swiftTUIVersion to tuiKitVersion

All 181 tests passing.
2026-01-28 19:32:09 +01:00

49 lines
1.1 KiB
Swift

//
// Scene.swift
// TUIKit
//
// Scene types for TUIKit applications.
//
/// The base protocol for scenes in TUIKit.
///
/// A scene represents a part of the app structure,
/// typically a window or a group of views.
public protocol Scene {}
// MARK: - WindowGroup
/// A scene that represents a single window (terminal).
///
/// `WindowGroup` is the main scene for most TUI apps.
///
/// # Example
///
/// ```swift
/// WindowGroup {
/// ContentView()
/// }
/// ```
public struct WindowGroup<Content: View>: Scene {
/// The content of the window.
public let content: Content
/// Creates a WindowGroup with the specified content.
///
/// - Parameter content: A ViewBuilder that defines the content.
public init(@ViewBuilder content: () -> Content) {
self.content = content()
}
}
// MARK: - SceneBuilder
/// A result builder for scene hierarchies.
@resultBuilder
public struct SceneBuilder {
/// Builds a single scene.
public static func buildBlock<Content: Scene>(_ content: Content) -> Content {
content
}
}