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

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()
}
}
}