import Adw public extension StatusPage { /// Creates a StatusPage with static text, icon, and child content. /// /// Values are applied once when the widget mounts. /// - Parameter title: The page title. /// - Parameter description: The optional page description. /// - Parameter iconName: The optional icon name. /// - Parameter child: The child view content. @_disfavoredOverload init(_ title: S, description: String? = nil, iconName: String? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }) { self.init(child: child) self = self.title(String(title)) if let description { self = self.description(description) } if let iconName { self = self.iconName(iconName) } } /// Creates a StatusPage whose text follows bindings. /// /// Binding modifiers update the widget in place and write widget changes back. /// - Parameter title: The title binding. /// - Parameter description: The optional description binding. /// - Parameter iconName: The optional icon binding. /// - Parameter child: The child view content. init(_ title: Portico.Binding, description: Portico.Binding? = nil, iconName: Portico.Binding? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }) { self.init(child: child) self = self.title(title) if let description { self = self.description(description) } if let iconName { self = self.iconName(iconName) } } /// Creates a StatusPage with live interpolated text values. /// /// Interpolated segments are re-evaluated when their dependencies change. /// - Parameter title: The interpolated title. /// - Parameter description: The optional interpolated description. /// - Parameter iconName: The optional interpolated icon name. /// - Parameter child: The child view content. init(_ title: Portico.InterpolatedText, description: Portico.InterpolatedText? = nil, iconName: Portico.InterpolatedText? = nil, @ViewBuilder child: @escaping () -> [AnyView] = { [] }) { self.init(child: child) self = self.title(title) if let description { self = self.description(description) } if let iconName { self = self.iconName(iconName) } } } extension WidgetView where Target: Adw.StatusPage { /// Applies the `.compact` style class. /// /// Makes the status page take less space; used in sidebars and popovers. /// /// - Parameter enabled: Whether the style class is applied. /// - Returns: A copy of this view with the modifier applied. public func compact(_ enabled: Bool = true) -> Self { styleClass("compact", enabled) } /// Applies the `.compact` style class. /// /// Makes the status page take less space; used in sidebars and popovers. /// /// - Parameter enabled: A binding that controls whether the class is applied. /// - Returns: A copy of this view with the modifier applied. public func compact(_ enabled: Binding) -> Self { styleClass("compact", enabled) } }