Cotton code
24 lines · 983 B · SwiftRaw
// The words every editor prints about its column: its name, the pencil hint// an empty field shows, and what VoiceOver reads.import CottonValues/// The words every editor prints about its column.enum EditorWords {    static func name(_ column: ColumnDefinition) -> String {        column.label    }    /// The pencil line an empty field shows: the column's own words for    /// nothing when it has some ("What needs doing?" — but not one that names    /// the record, which only its page can read), else "Add notes".    static func hint(_ column: ColumnDefinition) -> String {        if let placeholder = column.placeholder, !placeholder.isEmpty, !placeholder.contains("{") { return placeholder }        return "Add \(name(column).lowercased())"    }    /// What VoiceOver reads: the column's name, then its value or "empty".    static func label(_ column: ColumnDefinition, _ words: String?) -> String {        "\(name(column)), \(words ?? "empty")"    }}