david-swift 8eeda083e9
All checks were successful
Deploy Docs / publish (push) Successful in 18m28s
SwiftLint / SwiftLint (push) Successful in 5s
Separate AnyView extensions from widgets
2024-10-16 14:22:34 +02:00

29 lines
633 B
Swift

//
// Text.swift
// Adwaita
//
// Created by david-swift on 23.08.23.
//
import CAdw
/// A text widget.
public typealias Text = Label
extension Text {
/// Initialize a text widget.
/// - Parameter text: The content.
public init(_ text: String) {
self.init(label: text)
}
/// Set whether the text should ellipsize at the end.
/// - Parameter ellipsize: Whether it should ellipsize.
/// - Returns: The text widget.
public func ellipsize(_ ellipsize: Bool = true) -> AnyView {
inspect { storage, _ in gtk_label_set_ellipsize(storage.opaquePointer, PANGO_ELLIPSIZE_END) }
}
}