Skip to content

Commit 8e3c3d3

Browse files
committed
Fix linting
1 parent 95b9406 commit 8e3c3d3

11 files changed

+43
-33
lines changed

Sources/RichTextKit/Component/RichTextViewComponent+Indent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public extension RichTextViewComponent {
2222
var richTextIndent: CGFloat? {
2323
richTextParagraphStyle?.headIndent
2424
}
25-
25+
2626
/// Set the rich text indent.
2727
func setRichTextIndent(to val: CGFloat) {
2828
let style = NSMutableParagraphStyle(

Sources/RichTextKit/Component/RichTextViewComponent+Line.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public extension RichTextViewComponent {
2525
///
2626
/// > Todo: The function currently can't handle multiple
2727
/// selected paragraphs. If many paragraphs are selected,
28-
/// it will only affect the first one.
28+
/// it will only affect the first one.
2929
func setRichTextLineSpacing(_ spacing: CGFloat) {
3030
if richTextLineSpacing == spacing { return }
3131
let style = NSMutableParagraphStyle(

Sources/RichTextKit/Component/RichTextViewComponent+Paragraph.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public extension RichTextViewComponent {
2222
var richTextParagraphStyle: NSMutableParagraphStyle? {
2323
richTextAttribute(.paragraphStyle)
2424
}
25-
25+
2626
/// Set the paragraph style.
2727
///
2828
/// > Todo: The function currently can't handle multiple

Sources/RichTextKit/Coordinator/RichTextCoordinator+Actions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ extension RichTextCoordinator {
9292
guard let newValue else { return }
9393
textView.setRichText(newValue)
9494
}
95-
95+
9696
// TODO: This code should be handled by the component
9797
func setColor(_ color: RichTextColor, to val: ColorRepresentable) {
98-
var applyRange: NSRange? = nil
98+
var applyRange: NSRange?
9999
if textView.hasSelectedRange {
100100
applyRange = textView.selectedRange
101101
}

Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extension RichTextCoordinator {
3131
}
3232

3333
private extension RichTextCoordinator {
34-
34+
3535
func subscribe<T>(
3636
to publisher: Published<T>.Publisher,
3737
action: @escaping (T) -> Void

Sources/RichTextKit/Coordinator/RichTextCoordinator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ extension RichTextCoordinator {
169169
syncContextWithTextViewAfterDelay()
170170
}
171171
}
172-
172+
173173
func sync<T: Equatable>(_ prop: inout T, with value: T) {
174174
if prop == value { return }
175175
prop = value

Sources/RichTextKit/Keyboard/RichTextKeyboardToolbar.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public struct RichTextKeyboardToolbar<LeadingButtons: View, TrailingButtons: Vie
4343
- Parameters:
4444
- context: The context to affect.
4545
- style: The toolbar style to apply, by default ``RichTextKeyboardToolbarStyle/standard``.
46-
- configuration: The toolbar configuration to apply, by default ``RichTextKeyboardToolbarConfiguration/standard``.
46+
- configuration: The view configuration, by default ``RichTextKeyboardToolbarConfiguration/standard``.
4747
- leadingActions: The leading actions, by default `.undo`, `.redo` and `.copy`.
4848
- trailingActions: The trailing actions, by default `.dismissKeyboard`.
4949
- leadingButtons: The leading buttons to place after the leading actions.
@@ -76,7 +76,7 @@ public struct RichTextKeyboardToolbar<LeadingButtons: View, TrailingButtons: Vie
7676
- Parameters:
7777
- context: The context to affect.
7878
- style: The toolbar style to apply, by default ``RichTextKeyboardToolbarStyle/standard``.
79-
- configuration: The toolbar configuration to apply, by default ``RichTextKeyboardToolbarConfiguration/standard``.
79+
- configuration: The view configuration, by default ``RichTextKeyboardToolbarConfiguration/standard``.
8080
- leadingActions: The leading actions, by default `.undo`, `.redo` and `.copy`.
8181
- trailingActions: The trailing actions, by default `.dismissKeyboard`.
8282
- leadingButtons: The leading buttons to place after the leading actions.

Sources/RichTextKit/RichTextView_UIKit.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ open class RichTextView: UITextView, RichTextViewComponent {
101101
/// Keeps track of the data format used by the view.
102102
private var richTextDataFormat: RichTextDataFormat = .archivedData
103103

104-
105104
// MARK: - Overrides
106105

107106
/**
@@ -149,7 +148,6 @@ open class RichTextView: UITextView, RichTextViewComponent {
149148
}
150149
#endif
151150

152-
153151
// MARK: - Setup
154152

155153
/**

Tests/RichTextKitTests/RichTextCoordinatorIntegrationTests+UIKit.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ final class RichTextCoordinatorIntegrationTests: XCTestCase {
6868

6969
textView.simulateTyping(of: firstTypingPart)
7070

71+
let attributes = textView.richTextAttributes
72+
7173
textContext.selectRange(NSRange(location: Self.initialAttributedString.length, length: firstTypingPart.count))
72-
XCTAssertEqual(textView.richTextAttributes[.font] as? FontRepresentable, FontRepresentable.systemFont(ofSize: 16))
73-
XCTAssertEqual(textView.richTextAttributes[.foregroundColor] as? ColorRepresentable, ColorRepresentable.red)
74+
XCTAssertEqual(attributes[.font] as? FontRepresentable, FontRepresentable.systemFont(ofSize: 16))
75+
XCTAssertEqual(attributes[.foregroundColor] as? ColorRepresentable, ColorRepresentable.red)
7476

7577
textView.setRichTextStyle(.strikethrough, to: true)
76-
XCTAssertEqual(textView.richTextAttributes[.strikethroughStyle] as? Int, 1)
78+
XCTAssertEqual(attributes[.strikethroughStyle] as? Int, 1)
7779
}
7880
}
7981
#endif

Tests/RichTextKitTests/RichTextCoordinatorTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ final class RichTextCoordinatorTests: XCTestCase {
5959
XCTAssertEqual(coordinator.text.wrappedValue.string, "foo bar baz")
6060
XCTAssertEqual(coordinator.context.selectedRange, range)
6161
}
62-
62+
6363
func testChangingSomeViewPropertiesUpdatesContextAutomatically() {
6464
view.attributedString = .init(string: "foo bar")
6565
view.selectedRange = .init(location: 0, length: 0)
66-
66+
6767
XCTAssertFalse(context.hasSelectedRange)
6868
XCTAssertFalse(context.canCopy)
6969
XCTAssertFalse(context.canRedoLatestChange)
70-
70+
7171
view.typingAttributes[.font] = FontRepresentable.systemFont(ofSize: 10)
7272
view.attributedString = .init(string: "foo bar")
7373
view.selectedRange = .init(location: 1, length: 2)
74-
74+
7575
XCTAssertEqual(context.attributedString, view.attributedString)
7676
XCTAssertEqual(context.attributedString.string, "foo bar")
7777
XCTAssertEqual(context.selectedRange, view.selectedRange)
@@ -85,9 +85,9 @@ final class RichTextCoordinatorTests: XCTestCase {
8585
// XCTAssertEqual(context.lineSpacing, view.richTextLineSpacing) TODO: Not done yet
8686
XCTAssertEqual(context.textAlignment, view.richTextAlignment)
8787
}
88-
88+
8989
func testChangingOtherViewPropertiesUpdatesContextAfterExplicitUpdate() {
90-
90+
9191
}
9292

9393
func assertIsSyncedWithContext(macOSAlignment: RichTextAlignment = .left) {

0 commit comments

Comments
 (0)