macbackend/Sources/Core/Menu/MenuEitherView.swift
david-swift 3d2ef52cc8
Some checks failed
Deploy Docs / publish (push) Successful in 3m4s
SwiftLint / SwiftLint (push) Failing after 9s
Extract core target
2024-12-04 21:17:21 +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()
}
}