Skip to content

Commit 2a757a8

Browse files
LucianoPAlmeidabobgodwinx
authored andcommitted
Updating spm syntax to new swift-tools (#192)
* Upating dependencies to Rx 4.5.0 * Reverting version. * From 4.0.0 on package * Apply suggestions from code review
1 parent a05dd0b commit 2a757a8

File tree

6 files changed

+45
-14
lines changed

6 files changed

+45
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ Carthage
3535
# SPM
3636
#
3737
Packages
38+
.build

Package.resolved

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"object": {
3+
"pins": [
4+
{
5+
"package": "RxSwift",
6+
"repositoryURL": "https://github.com/ReactiveX/RxSwift.git",
7+
"state": {
8+
"branch": null,
9+
"revision": "12cccb171ad9038251af6883807f0290c1d75a5b",
10+
"version": "4.0.0"
11+
}
12+
}
13+
]
14+
},
15+
"version": 1
16+
}

Package.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1+
// swift-tools-version:5.0
2+
13
import PackageDescription
24

35
let package = Package(
46
name: "Action",
5-
targets: [],
7+
products: [
8+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
9+
.library(
10+
name: "Action",
11+
targets: ["Action"]),
12+
],
613
dependencies: [
7-
.Package(url: "https://github.com/ReactiveX/RxSwift.git", Version(4, 0, 0, prereleaseIdentifiers: ["alpha.1"]))
14+
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "4.0.0")
815
],
9-
exclude: ["Tests/"]
16+
targets: [
17+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
18+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
19+
.target(
20+
name: "Action",
21+
dependencies: ["RxSwift", "RxCocoa"],
22+
path: "Sources/Action")
23+
]
1024
)
1125

Sources/Action/UIKitExtensions/UIAlertAction+Action.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public typealias ActionStyle = UIAlertActionStyle
1111

1212
public extension UIAlertAction {
1313

14-
public static func Action(_ title: String?, style: ActionStyle) -> UIAlertAction {
14+
static func Action(_ title: String?, style: ActionStyle) -> UIAlertAction {
1515
return UIAlertAction(title: title, style: style, handler: { action in
1616
action.rx.action?.execute()
1717
return
@@ -24,7 +24,7 @@ public extension Reactive where Base: UIAlertAction {
2424
/// Binds enabled state of action to button, and subscribes to rx_tap to execute action.
2525
/// These subscriptions are managed in a private, inaccessible dispose bag. To cancel
2626
/// them, set the rx.action to nil or another action.
27-
public var action: CocoaAction? {
27+
var action: CocoaAction? {
2828
get {
2929
var action: CocoaAction?
3030
action = objc_getAssociatedObject(base, &AssociatedKeys.Action) as? Action
@@ -48,7 +48,7 @@ public extension Reactive where Base: UIAlertAction {
4848
}
4949
}
5050

51-
public var enabled: AnyObserver<Bool> {
51+
var enabled: AnyObserver<Bool> {
5252
return AnyObserver { [weak base] event in
5353
MainScheduler.ensureExecutingOnScheduler()
5454

Sources/Action/UIKitExtensions/UIBarButtonItem+Action.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public extension Reactive where Base: UIBarButtonItem {
99
/// Binds enabled state of action to bar button item, and subscribes to rx_tap to execute action.
1010
/// These subscriptions are managed in a private, inaccessible dispose bag. To cancel
1111
/// them, set the rx.action to nil or another action.
12-
public var action: CocoaAction? {
12+
var action: CocoaAction? {
1313
get {
1414
var action: CocoaAction?
1515
action = objc_getAssociatedObject(self.base, &AssociatedKeys.Action) as? Action
@@ -38,7 +38,7 @@ public extension Reactive where Base: UIBarButtonItem {
3838
}
3939
}
4040

41-
public func bind<Input, Output>(to action: Action<Input, Output>, inputTransform: @escaping (Base) -> (Input)) {
41+
func bind<Input, Output>(to action: Action<Input, Output>, inputTransform: @escaping (Base) -> (Input)) {
4242
unbindAction()
4343

4444
self.tap
@@ -52,12 +52,12 @@ public extension Reactive where Base: UIBarButtonItem {
5252
.disposed(by: self.base.actionDisposeBag)
5353
}
5454

55-
public func bind<Input, Output>(to action: Action<Input, Output>, input: Input) {
55+
func bind<Input, Output>(to action: Action<Input, Output>, input: Input) {
5656
self.bind(to: action) { _ in input}
5757
}
5858

5959
/// Unbinds any existing action, disposing of all subscriptions.
60-
public func unbindAction() {
60+
func unbindAction() {
6161
self.base.resetActionDisposeBag()
6262
}
6363
}

Sources/Action/UIKitExtensions/UIRefreshControl+Action.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public extension Reactive where Base: UIRefreshControl {
99
// These subscriptions are managed in a private, inaccessible dispose bag. To cancel
1010
// them, set the rx.action to nil or another action.
1111

12-
public var action: CocoaAction? {
12+
var action: CocoaAction? {
1313
get {
1414
var action: CocoaAction?
1515
action = objc_getAssociatedObject(base, &AssociatedKeys.Action) as? Action
@@ -30,7 +30,7 @@ public extension Reactive where Base: UIRefreshControl {
3030
}
3131
}
3232

33-
public func bind<Input, Output>(to action: Action<Input, Output>, inputTransform: @escaping (Base) -> (Input)) {
33+
func bind<Input, Output>(to action: Action<Input, Output>, inputTransform: @escaping (Base) -> (Input)) {
3434
unbindAction()
3535

3636
self.controlEvent(.valueChanged)
@@ -49,12 +49,12 @@ public extension Reactive where Base: UIRefreshControl {
4949
.disposed(by: self.base.actionDisposeBag)
5050
}
5151

52-
public func bind<Input, Output>(to action: Action<Input, Output>, input: Input) {
52+
func bind<Input, Output>(to action: Action<Input, Output>, input: Input) {
5353
self.bind(to: action) { _ in input}
5454
}
5555

5656
/// Unbinds any existing action, disposing of all subscriptions.
57-
public func unbindAction() {
57+
func unbindAction() {
5858
self.base.resetActionDisposeBag()
5959
}
6060
}

0 commit comments

Comments
 (0)