adwaita-swift/Sources/Adwaita/Menu/MenuEitherView.swift
david-swift 04c77831b5
Some checks are pending
Deploy Docs / publish (push) Waiting to run
SwiftLint / SwiftLint (push) Waiting to run
Remove Core library
2025-10-30 21:36:13 +01:00

24 lines
558 B
Swift

//
// MenuEitherView.swift
// Adwaita
//
// 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()
}
}