david-swift d8de611510 Add support for auto-generated widget bindings
Additionally fix an update problem occurring with custom views
2024-01-22 21:45:31 +01:00

34 lines
748 B
Swift

//
// Banner+.swift
// Adwaita
//
// Created by david-swift on 17.01.24.
//
import CAdw
extension Banner {
/// Initialize a text widget.
/// - Parameters:
/// - title: The content.
/// - visible: Whether the banner is visible.
public init(_ title: String, visible: Bool) {
self.init(title: title)
self = self.revealed(visible)
}
/// Configure the banner's button.
/// - Parameters:
/// - label: The button's title.
/// - handler: The button's handler.
/// - Returns: The banner.
public func button(_ label: String, handler: @escaping () -> Void) -> Self {
buttonLabel(label)
.buttonClicked {
handler()
}
}
}