Skip to content

Commit c71b180

Browse files
authored
Fixes SwiftLint warnings (#325)
1 parent 5035b8c commit c71b180

3 files changed

Lines changed: 3 additions & 15 deletions

File tree

Example/Example/Main/MainViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import UIKit
55
final class MainViewController: UIViewController {
66
override var textInputContextIdentifier: String? {
77
// Returning a unique identifier makes iOS remember the user's selection of keyboard.
8-
return "RunestoneExample.Main"
8+
"RunestoneExample.Main"
99
}
1010

1111
private let contentView = MainView()

Sources/Runestone/TextView/Core/TextInputStringTokenizer.swift

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ final class TextInputStringTokenizer: UITextInputStringTokenizer {
2828
}
2929
}
3030

31-
override func isPosition(_ position: UITextPosition,
32-
withinTextUnit granularity: UITextGranularity,
33-
inDirection direction: UITextDirection) -> Bool {
34-
super.isPosition(position, withinTextUnit: granularity, inDirection: direction)
35-
}
36-
3731
override func position(from position: UITextPosition,
3832
toBoundary granularity: UITextGranularity,
3933
inDirection direction: UITextDirection) -> UITextPosition? {
@@ -47,12 +41,6 @@ final class TextInputStringTokenizer: UITextInputStringTokenizer {
4741
return super.position(from: position, toBoundary: granularity, inDirection: direction)
4842
}
4943
}
50-
51-
override func rangeEnclosingPosition(_ position: UITextPosition,
52-
with granularity: UITextGranularity,
53-
inDirection direction: UITextDirection) -> UITextRange? {
54-
super.rangeEnclosingPosition(position, with: granularity, inDirection: direction)
55-
}
5644
}
5745

5846
// MARK: - Lines
@@ -129,7 +117,7 @@ private extension TextInputStringTokenizer {
129117
private func isPosition(_ position: UITextPosition, atParagraphBoundaryInDirection direction: UITextDirection) -> Bool {
130118
// I can't seem to make Ctrl+A, Ctrl+E, Cmd+Left, and Cmd+Right work properly if this function returns anything but false.
131119
// I've tried various ways of determining the paragraph boundary but UIKit doesn't seem to be happy with anything I come up with ultimately leading to incorrect keyboard navigation. I haven't yet found any drawbacks to returning false in all cases.
132-
return false
120+
false
133121
}
134122

135123
private func position(from position: UITextPosition, toParagraphBoundaryInDirection direction: UITextDirection) -> UITextPosition? {

Tests/RunestoneTests/TextInputStringTokenizerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ extension TextInputStringTokenizerTests {
253253
private extension TextInputStringTokenizerTests {
254254
private var sampleText: String {
255255
// swiftlint:disable line_length
256-
return """
256+
"""
257257
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras commodo pretium lorem et scelerisque. Sed urna massa, eleifend vel suscipit et, finibus ut nisi. Praesent ullamcorper justo ut lectus faucibus venenatis. Suspendisse lobortis libero sed odio iaculis, quis blandit ante accumsan.
258258
259259
Quisque sed hendrerit diam. Quisque ut enim ligula.

0 commit comments

Comments
 (0)