mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
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.
38 lines
967 B
Swift
38 lines
967 B
Swift
//
|
|
// View.swift
|
|
// TUIKit
|
|
//
|
|
// The base protocol for all TUIKit views.
|
|
//
|
|
|
|
/// The base protocol for all TUIKit views.
|
|
///
|
|
/// `View` is the central protocol in TUIKit and works similarly to `View` in SwiftUI.
|
|
/// It defines how components declare their structure and content.
|
|
///
|
|
/// Every View defines a `body` composed of other Views.
|
|
/// This enables a hierarchical, declarative UI description.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// ```swift
|
|
/// struct MyView: View {
|
|
/// var body: some View {
|
|
/// Text("Hello, TUIKit!")
|
|
/// }
|
|
/// }
|
|
/// ```
|
|
public protocol View {
|
|
/// The type of the body view.
|
|
///
|
|
/// Swift automatically infers this type from the `body` implementation.
|
|
associatedtype Body: View
|
|
|
|
/// The content and behavior of this view.
|
|
///
|
|
/// Implement this property to define the structure of your view.
|
|
/// The body consists of other Views that together form the UI.
|
|
@ViewBuilder
|
|
var body: Body { get }
|
|
}
|