Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes SwiftLint warnings #325

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Example/Example/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import UIKit
final class MainViewController: UIViewController {
override var textInputContextIdentifier: String? {
// Returning a unique identifier makes iOS remember the user's selection of keyboard.
return "RunestoneExample.Main"
"RunestoneExample.Main"
}

private let contentView = MainView()
Expand Down
14 changes: 1 addition & 13 deletions Sources/Runestone/TextView/Core/TextInputStringTokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ final class TextInputStringTokenizer: UITextInputStringTokenizer {
}
}

override func isPosition(_ position: UITextPosition,
withinTextUnit granularity: UITextGranularity,
inDirection direction: UITextDirection) -> Bool {
super.isPosition(position, withinTextUnit: granularity, inDirection: direction)
}

override func position(from position: UITextPosition,
toBoundary granularity: UITextGranularity,
inDirection direction: UITextDirection) -> UITextPosition? {
Expand All @@ -47,12 +41,6 @@ final class TextInputStringTokenizer: UITextInputStringTokenizer {
return super.position(from: position, toBoundary: granularity, inDirection: direction)
}
}

override func rangeEnclosingPosition(_ position: UITextPosition,
with granularity: UITextGranularity,
inDirection direction: UITextDirection) -> UITextRange? {
super.rangeEnclosingPosition(position, with: granularity, inDirection: direction)
}
}

// MARK: - Lines
Expand Down Expand Up @@ -129,7 +117,7 @@ private extension TextInputStringTokenizer {
private func isPosition(_ position: UITextPosition, atParagraphBoundaryInDirection direction: UITextDirection) -> Bool {
// I can't seem to make Ctrl+A, Ctrl+E, Cmd+Left, and Cmd+Right work properly if this function returns anything but false.
// 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.
return false
false
}

private func position(from position: UITextPosition, toParagraphBoundaryInDirection direction: UITextDirection) -> UITextPosition? {
Expand Down
2 changes: 1 addition & 1 deletion Tests/RunestoneTests/TextInputStringTokenizerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ extension TextInputStringTokenizerTests {
private extension TextInputStringTokenizerTests {
private var sampleText: String {
// swiftlint:disable line_length
return """
"""
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.

Quisque sed hendrerit diam. Quisque ut enim ligula.
Expand Down
Loading