diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6a17e22..6cb92e3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,12 @@ jobs: runs-on: macOS-latest strategy: matrix: - destination: ['platform=iOS Simulator,OS=14.4,name=iPhone 11'] + destination: ['platform=iOS Simulator,OS=15.2,name=iPhone 11'] steps: - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.2.1' - name: Build and test run: set -o pipefail && xcodebuild -project Eureka.xcodeproj -scheme 'Eureka' -sdk 'iphonesimulator' -destination "${{ matrix.destination }}" -configuration Debug test | xcpretty diff --git a/Source/Core/Cell.swift b/Source/Core/Cell.swift index 7d008238..84d138f4 100644 --- a/Source/Core/Cell.swift +++ b/Source/Core/Cell.swift @@ -52,7 +52,7 @@ open class BaseCell: UITableViewCell, BaseCellType { if let formVC = responder as? FormViewController { return formVC } - responder = (responder as? UIResponder)?.next + responder = responder?.next } return nil } diff --git a/Source/Core/Core.swift b/Source/Core/Core.swift index 1c7ffddf..1faa07d9 100644 --- a/Source/Core/Core.swift +++ b/Source/Core/Core.swift @@ -1088,6 +1088,26 @@ extension FormViewController { navigateTo(direction: .down) } + open override func pressesBegan(_ presses: Set, with event: UIPressesEvent?) { + var didHandleEvent = false + for press in presses { + guard let key = press.key, + key.keyCode == .keyboardTab, + !key.modifierFlags.contains(.command) else { continue } + if key.modifierFlags.contains(.shift) { + navigateTo(direction: .up) + } else { + navigateTo(direction: .down) + } + didHandleEvent = true + } + + if !didHandleEvent { + // Didn't handle this key press, so pass the event to the next responder. + super.pressesBegan(presses, with: event) + } + } + public func navigateTo(direction: Direction) { guard let currentCell = tableView?.findFirstResponder()?.formCell() else { return } guard let currentIndexPath = tableView?.indexPath(for: currentCell) else { return }