macbackend/Sources/MacBackend/Menu/MenuEitherView.swift
david-swift e989bea14e
All checks were successful
Deploy Docs / publish (push) Successful in 2m38s
Initial commit
2024-12-02 22:14:13 +01:00

24 lines
561 B
Swift

//
// MenuEitherView.swift
// MacBackend
//
// Created by david-swift on 06.08.2024.
//
/// Show one of two views depending on a condition.
public struct MenuEitherView: Meta.EitherView, SimpleView {
/// The view.
public var view: Body
/// Initialize an either view.
/// - Parameters:
/// - condition: The condition.
/// - view1: The first view.
/// - view2: The second view.
public init(_ condition: Bool, view1: () -> Body, else view2: () -> Body) {
self.view = condition ? view1() : view2()
}
}