Skip to content

Commit 3e8d8a5

Browse files
committed
Remove alignment picker style
1 parent 6e487e0 commit 3e8d8a5

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

Sources/RichTextKit/Alignment/RichTextAlignment+Picker.swift

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,16 @@ public extension RichTextAlignment {
2323

2424
- Parameters:
2525
- selection: The binding to update with the picker.
26-
- style: The style to apply, by default `.standard`.
2726
- values: The pickable alignments, by default `.allCases`.
2827
*/
2928
public init(
3029
selection: Binding<RichTextAlignment>,
31-
style: Style = .standard,
3230
values: [RichTextAlignment] = RichTextAlignment.allCases
3331
) {
3432
self._selection = selection
35-
self.style = style
3633
self.values = values
3734
}
3835

39-
let style: Style
4036
let values: [RichTextAlignment]
4137

4238
@Binding
@@ -45,37 +41,15 @@ public extension RichTextAlignment {
4541
public var body: some View {
4642
SwiftUI.Picker("", selection: $selection) {
4743
ForEach(RichTextAlignment.allCases) { value in
48-
value.icon
49-
.foregroundColor(style.iconColor)
50-
.accessibilityLabel(value.title)
51-
.tag(value)
44+
value.label
45+
.labelStyle(.iconOnly)
5246
}
5347
}
5448
.accessibilityLabel(RTKL10n.textAlignment.text)
5549
}
5650
}
5751
}
5852

59-
public extension RichTextAlignment.Picker {
60-
61-
/// This style can be used to style an alignment picker.
62-
struct Style {
63-
64-
public init(
65-
iconColor: Color = .primary
66-
) {
67-
self.iconColor = iconColor
68-
}
69-
70-
public var iconColor: Color
71-
}
72-
}
73-
74-
public extension RichTextAlignment.Picker.Style {
75-
76-
static var standard = Self.init()
77-
}
78-
7953
struct RichTextAlignment_Picker_Previews: PreviewProvider {
8054

8155
struct Preview: View {

Tests/RichTextKitTests/Alignment/RichTextAlignmentPickerTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@ final class RichTextAlignment_PickerTests: XCTestCase {
1616
func testCanBeCreatedWithAllParameters() {
1717
let picker = RichTextAlignment.Picker(
1818
selection: .constant(.left),
19-
style: .init(iconColor: .red),
2019
values: [.left]
2120
)
2221

23-
XCTAssertEqual(picker.style.iconColor, .red)
2422
XCTAssertEqual(picker.values, [.left])
2523
}
2624

2725
func testCanBeCreatedWithDefaultParameters() {
2826
let picker = RichTextAlignment.Picker(
2927
selection: .constant(.left))
3028

31-
XCTAssertEqual(picker.style.iconColor, .primary)
3229
XCTAssertEqual(picker.values, RichTextAlignment.allCases)
3330
}
3431
}

0 commit comments

Comments
 (0)