Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8cd22bc

Browse files
committed
Create UIKeyCommantTableView
1 parent 2086a74 commit 8cd22bc

File tree

6 files changed

+384
-6
lines changed

6 files changed

+384
-6
lines changed

Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,29 @@ import PackageDescription
55

66
let package = Package(
77
name: "UIKeyCommandTableView",
8+
platforms: [
9+
.iOS(.v11)
10+
],
811
products: [
912
// Products define the executables and libraries a package produces, and make them visible to other packages.
1013
.library(
1114
name: "UIKeyCommandTableView",
12-
targets: ["UIKeyCommandTableView"]),
15+
targets: ["UIKeyCommandTableView"]
16+
),
1317
],
1418
dependencies: [
1519
// Dependencies declare other packages that this package depends on.
16-
// .package(url: /* package url */, from: "1.0.0"),
20+
.package(url: "https://github.com/ipedro/UIKeyCommandOptions.git", from: "0.1.1"),
1721
],
1822
targets: [
1923
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
2024
// Targets can depend on other targets in this package, and on products in packages this package depends on.
2125
.target(
2226
name: "UIKeyCommandTableView",
23-
dependencies: []),
27+
dependencies: [
28+
._byNameItem(name: "UIKeyCommandOptions", condition: nil)
29+
]
30+
),
2431
.testTarget(
2532
name: "UIKeyCommandTableViewTests",
2633
dependencies: ["UIKeyCommandTableView"]),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// IndexPath+InvalidReason.swift
3+
// UIKeyCommandTableView
4+
//
5+
// Created by Pedro on 10.04.21.
6+
//
7+
8+
import Foundation
9+
10+
extension IndexPath {
11+
12+
enum InvalidReason: Error {
13+
case sectionBelowBounds, sectionAboveBounds, rowBelowBounds, rowAboveBounds
14+
}
15+
16+
static var first = IndexPath(row: .zero, section: .zero)
17+
18+
func previousRow() -> IndexPath {
19+
IndexPath(row: row - 1, section: section)
20+
}
21+
22+
func nextRow() -> IndexPath {
23+
IndexPath(row: row + 1, section: section)
24+
}
25+
26+
func nextSection() -> IndexPath {
27+
IndexPath(row: .zero, section: section + 1)
28+
}
29+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// NSObjectProtocol+Debounce.swift
3+
// UIKeyCommandTableView
4+
//
5+
// Created by Pedro Almeida on 15.10.20.
6+
//
7+
8+
import Foundation
9+
10+
extension NSObjectProtocol where Self: NSObject {
11+
func debounce(_ aSelector: Selector, after delay: TimeInterval, object: Any? = nil) {
12+
Self.cancelPreviousPerformRequests(
13+
withTarget: self,
14+
selector: aSelector,
15+
object: object
16+
)
17+
18+
perform(aSelector, with: object, afterDelay: delay)
19+
}
20+
}

0 commit comments

Comments
 (0)