File tree Expand file tree Collapse file tree
Sources/UIKeyCommandTableView Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,30 +149,12 @@ public class UIKeyCommandTableView: UITableView {
149149
150150 @objc
151151 public func selectPreviousRow( ) {
152- guard let currentSelection = indexPathForSelectedRow else {
153- return selectRowIfPossible ( at: {
154- if let lastVisibleRow = indexPathsForVisibleRows? . last {
155- return lastVisibleRow
156- }
157- return indexPathForLastRowInLastSection
158- } ( ) )
159- }
160-
161- selectRowIfPossible ( at: currentSelection. previousRow ( ) )
152+ selectRowIfPossible ( at: indexPathForSelectedRow? . previousRow ( ) ?? indexPathForLastVisibleRow)
162153 }
163154
164155 @objc
165156 public func selectNextRow( ) {
166- guard let currentSelection = indexPathForSelectedRow else {
167- return selectRowIfPossible ( at: {
168- for indexPath in indexPathsForVisibleRows ?? [ ] where isRowVisible ( at: indexPath) == . fullyVisible {
169- return indexPath
170- }
171- return IndexPath ( row: NSNotFound, section: . zero)
172- } ( ) )
173- }
174-
175- selectRowIfPossible ( at: currentSelection. nextRow ( ) )
157+ selectRowIfPossible ( at: indexPathForSelectedRow? . nextRow ( ) ?? indexPathForFirstVisibleRow)
176158 }
177159
178160}
You can’t perform that action at this time.
0 commit comments