david-swift 64c536b03c
Some checks are pending
Deploy Docs / publish (push) Waiting to run
SwiftLint / SwiftLint (push) Waiting to run
Add EitherView instructions for new update system
2026-02-02 22:29:52 +01:00

25 lines
596 B
Swift

//
// EitherView.swift
// Meta
//
// Created by david-swift on 06.08.24.
//
/// A view building conditional bodies.
///
/// Do not forget to call the update function after constructing a new UI.
public protocol EitherView: AnyView {
/// Initialize the either view.
/// - Parameters:
/// - condition: Whether the first view is visible-
/// - view1: The first view, visible if true.
/// - view2: The second view, visible if false.
init(
_ condition: Bool,
@ViewBuilder view1: () -> Body,
@ViewBuilder else view2: () -> Body
)
}