Skip to content

Commit 31514e5

Browse files
committed
Adjust rich text color to not return undefined in all cases
1 parent 11e6ba5 commit 31514e5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Demo/iOS/EditorScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private extension EditorScreen {
5959
trailingButtons: {}
6060
) {
6161
var sheet = $0
62-
sheet.colorPickers = .all
62+
// sheet.colorPickers = .all
6363
return sheet
6464
}
6565
}

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This release starts moving types and views that relate to other types into the t
2323
* All types that implement `RichTextLabelValue` get a `label` that has improved accessibility.
2424

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

Sources/RichTextKit/Colors/RichTextColor.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public extension RichTextColor {
3838

3939
/// The unique color ID.
4040
var id: String { rawValue }
41+
42+
/// All relevant cases.
43+
static var allCases: [RichTextColor] {
44+
[
45+
.foreground,
46+
.background,
47+
.strikethrough,
48+
.stroke,
49+
.underline
50+
]
51+
}
4152

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

0 commit comments

Comments
 (0)