// // DisabledWrapper.swift // MacBackend // // Created by david-swift on 18.01.2025. // import SwiftUI /// Wrap a view to disable it. public struct DisabledWrapper: SwiftUIWidget { /// Whether the view is disabled. var disabled: Bool /// The content. var content: Body /// The wrapped views. public var wrappedViews: [String: Meta.AnyView] { [.mainContent: content] } /// Initialize a disabled wrapper. /// - Parameters: /// - disabled: Whether the view is disabled. /// - content: The view content. public init(disabled: Bool, @Meta.ViewBuilder content: () -> Body) { self.content = content() self.disabled = disabled } /// Get the SwiftUI view. /// - Parameter properties: The widget data. /// - Returns: The SwiftUI view. public static func view(properties: Self) -> some SwiftUI.View { MacBackendView(.mainContent) .disabled(properties.disabled) } }