import Adw public extension SwitchRow { /// Creates a SwitchRow with static text and active state. /// /// Values are applied once when the widget mounts. /// - Parameter title: The row title. /// - Parameter subtitle: The optional row subtitle. /// - Parameter active: The optional active state. @_disfavoredOverload init(_ title: S, subtitle: String? = nil, active: Bool? = nil) { self.init() self = self.title(String(title)) if let subtitle { self = self.subtitle(subtitle) } if let active { self = self.active(active) } } /// Creates a SwitchRow whose text and active state follow bindings. /// /// Binding modifiers update the widget in place and write widget changes back. /// - Parameter title: The title binding. /// - Parameter subtitle: The optional subtitle binding. /// - Parameter active: The optional active-state binding. init(_ title: Portico.Binding, subtitle: Portico.Binding? = nil, active: Portico.Binding? = nil) { self.init() self = self.title(title) if let subtitle { self = self.subtitle(subtitle) } if let active { self = self.active(active) } } /// Creates a SwitchRow with live interpolated text values. /// /// Interpolated segments are re-evaluated when their dependencies change. /// - Parameter title: The interpolated title. /// - Parameter subtitle: The optional interpolated subtitle. /// - Parameter active: The optional active state. init(_ title: Portico.InterpolatedText, subtitle: Portico.InterpolatedText? = nil, active: Bool? = nil) { self.init() self = self.title(title) if let subtitle { self = self.subtitle(subtitle) } if let active { self = self.active(active) } } /// Creates a SwitchRow with a static title and a bound active state. /// /// The active binding updates the widget in place and receives widget changes. /// - Parameter title: The row title. /// - Parameter subtitle: The optional row subtitle. /// - Parameter active: The required active-state binding. init(_ title: S, subtitle: String? = nil, active: Portico.Binding) { self.init() self = self.title(String(title)) if let subtitle { self = self.subtitle(subtitle) } self = self.active(active) } }