Skip to content

Commit

Permalink
Adjust rich text color to not return undefined in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Jan 23, 2024
1 parent 11e6ba5 commit 31514e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Demo/iOS/EditorScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private extension EditorScreen {
trailingButtons: {}
) {
var sheet = $0
sheet.colorPickers = .all
// sheet.colorPickers = .all
return sheet
}
}
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This release starts moving types and views that relate to other types into the t
* All types that implement `RichTextLabelValue` get a `label` that has improved accessibility.

* `RichTextColor` `.adjust` now takes an optional color.
* `RichTextColor` `.allCases` no longer returns `undefined`.
* `RichTextFormatSheet` no longer hard-codes an accent color.
* `RichTextStyle` views no longer use a style - use `foregroundStyle`, `tint` and `accentColor` instead.

Expand Down
11 changes: 11 additions & 0 deletions Sources/RichTextKit/Colors/RichTextColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ public extension RichTextColor {

/// The unique color ID.
var id: String { rawValue }

/// All relevant cases.
static var allCases: [RichTextColor] {
[
.foreground,
.background,
.strikethrough,
.stroke,
.underline
]
}

/// The corresponding rich text attribute, if any.
var attribute: NSAttributedString.Key? {
Expand Down

0 comments on commit 31514e5

Please sign in to comment.