Skip to content

Commit 7c11e59

Browse files
author
Tom Burns
committed
bindTo -> bind(to:
1 parent 24b40d3 commit 7c11e59

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

Demo/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ class ViewController: UIViewController {
8383
})
8484
.addDisposableTo(self.disposableBag)
8585

86-
button1.rx.bindTo(action: sharedAction, input: .button("Button 1"))
86+
button1.rx.bind(to: action: sharedAction, input: .button("Button 1"))
8787

88-
button2.rx.bindTo(action: sharedAction) { _ in
88+
button2.rx.bind(to: action: sharedAction) { _ in
8989
return .button("Button 2")
9090
}
91-
self.navigationItem.leftBarButtonItem?.rx.bindTo(action: sharedAction, input: .barButton)
91+
self.navigationItem.leftBarButtonItem?.rx.bind(to: action: sharedAction, input: .barButton)
9292

9393
sharedAction.executing.debounce(0, scheduler: MainScheduler.instance).subscribe(onNext: { [weak self] executing in
9494
if (executing) {

Sources/Action/Action.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public final class Action<Input, Element> {
9797

9898
Observable
9999
.combineLatest(executing, enabledIf) { !$0 && $1 }
100-
.bindTo(enabledSubject)
100+
.bind(to: enabledSubject)
101101
.addDisposableTo(disposeBag)
102102
}
103103

Sources/Action/UIKitExtensions/AlertAction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public extension Reactive where Base: UIAlertAction {
3636
if let action = newValue {
3737
action
3838
.enabled
39-
.bindTo(self.enabled)
39+
.bind(to: self.enabled)
4040
.addDisposableTo(self.base.actionDisposeBag)
4141
}
4242
}

Sources/Action/UIKitExtensions/UIBarButtonItem+Action.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public extension Reactive where Base: UIBarButtonItem {
2727
if let action = newValue {
2828
action
2929
.enabled
30-
.bindTo(self.isEnabled)
30+
.bind(to: self.isEnabled)
3131
.addDisposableTo(self.base.actionDisposeBag)
3232

3333
self.tap.subscribe(onNext: { (_) in
@@ -43,17 +43,17 @@ public extension Reactive where Base: UIBarButtonItem {
4343

4444
self.tap
4545
.map { inputTransform(self.base) }
46-
.bindTo(action.inputs)
46+
.bind(to: action.inputs)
4747
.addDisposableTo(self.base.actionDisposeBag)
4848

4949
action
5050
.enabled
51-
.bindTo(self.isEnabled)
51+
.bind(to: self.isEnabled)
5252
.addDisposableTo(self.base.actionDisposeBag)
5353
}
5454

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

5959
/// Unbinds any existing action, disposing of all subscriptions.

Sources/Action/UIKitExtensions/UIButton+Rx.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public extension Reactive where Base: UIButton {
2626
if let action = newValue {
2727
action
2828
.enabled
29-
.bindTo(self.isEnabled)
29+
.bind(to: self.isEnabled)
3030
.addDisposableTo(self.base.actionDisposeBag)
3131

3232
// Technically, this file is only included on tv/iOS platforms,
@@ -72,14 +72,14 @@ public extension Reactive where Base: UIButton {
7272
guard let controlEvent = lookupControlEvent else {
7373
return
7474
}
75-
self.bindTo(action: action, controlEvent: controlEvent, inputTransform: inputTransform)
75+
self.bind(to: action: action, controlEvent: controlEvent, inputTransform: inputTransform)
7676
}
7777

7878
/// Binds enabled state of action to button, and subscribes to rx_tap to execute action with given input value.
7979
/// These subscriptions are managed in a private, inaccessible dispose bag. To cancel
8080
/// them, call bindToAction with another action or call unbindAction().
8181
public func bindTo<Input, Output>(action: Action<Input, Output>, input: Input) {
82-
self.bindTo(action: action) { _ in input }
82+
self.bind(to: action: action) { _ in input }
8383
}
8484
}
8585
#endif

Sources/Action/UIKitExtensions/UIControl+Rx.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public extension Reactive where Base: UIControl {
1414
// For each tap event, use the inputTransform closure to provide an Input value to the action
1515
controlEvent
1616
.map { inputTransform(self.base) }
17-
.bindTo(action.inputs)
17+
.bind(to: action.inputs)
1818
.addDisposableTo(self.base.actionDisposeBag)
1919

2020
// Bind the enabled state of the control to the enabled state of the action
2121
action
2222
.enabled
23-
.bindTo(self.isEnabled)
23+
.bind(to: self.isEnabled)
2424
.addDisposableTo(self.base.actionDisposeBag)
2525
}
2626

Tests/ActionTests/ActionTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,27 @@ class ActionTests: QuickSpec {
3434

3535
func bindAction(action: Action<String, String>) {
3636
action.inputs
37-
.bindTo(inputs)
37+
.bind(to: inputs)
3838
.addDisposableTo(disposeBag)
3939

4040
action.elements
41-
.bindTo(elements)
41+
.bind(to: elements)
4242
.addDisposableTo(disposeBag)
4343

4444
action.errors
45-
.bindTo(errors)
45+
.bind(to: errors)
4646
.addDisposableTo(disposeBag)
4747

4848
action.enabled
49-
.bindTo(enabled)
49+
.bind(to: enabled)
5050
.addDisposableTo(disposeBag)
5151

5252
action.executing
53-
.bindTo(executing)
53+
.bind(to: executing)
5454
.addDisposableTo(disposeBag)
5555

5656
action.executionObservables
57-
.bindTo(executionObservables)
57+
.bind(to: executionObservables)
5858
.addDisposableTo(disposeBag)
5959

6060
// Dummy subscription for multiple subcription tests
@@ -376,18 +376,18 @@ class ActionTests: QuickSpec {
376376

377377
func bindAndExecuteTwice(action: Action<String, String>) {
378378
action.executionObservables
379-
.bindTo(executionObservables)
379+
.bind(to: executionObservables)
380380
.addDisposableTo(disposeBag)
381381

382382
scheduler.scheduleAt(10) {
383383
action.execute("a")
384-
.bindTo(element)
384+
.bind(to: element)
385385
.addDisposableTo(disposeBag)
386386
}
387387

388388
scheduler.scheduleAt(20) {
389389
action.execute("b")
390-
.bindTo(element)
390+
.bind(to: element)
391391
.addDisposableTo(disposeBag)
392392
}
393393

@@ -484,18 +484,18 @@ class ActionTests: QuickSpec {
484484
action = Action { Observable.just($0).sample(trigger) }
485485

486486
action.executionObservables
487-
.bindTo(executionObservables)
487+
.bind(to: executionObservables)
488488
.addDisposableTo(disposeBag)
489489

490490
scheduler.scheduleAt(10) {
491491
action.execute("a")
492-
.bindTo(element)
492+
.bind(to: element)
493493
.addDisposableTo(disposeBag)
494494
}
495495

496496
scheduler.scheduleAt(20) {
497497
action.execute("b")
498-
.bindTo(secondElement)
498+
.bind(to: secondElement)
499499
.addDisposableTo(disposeBag)
500500
}
501501

Tests/ActionTests/BindToTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BindToTests: QuickSpec {
2626
called = true
2727
return .empty()
2828
})
29-
button.rx.bindTo(action: action, input: "Hi there!")
29+
button.rx.bind(to: action: action, input: "Hi there!")
3030
// Setting the action has an asynchronous effect of adding a target.
3131
expect(button.allTargets).toEventuallyNot( beEmpty() )
3232

@@ -42,7 +42,7 @@ class BindToTests: QuickSpec {
4242
called = true
4343
return .empty()
4444
})
45-
button.rx.bindTo(action: action, controlEvent: button.rx.tap, inputTransform: { input in "\(input)" })
45+
button.rx.bind(to: action: action, controlEvent: button.rx.tap, inputTransform: { input in "\(input)" })
4646
// Setting the action has an asynchronous effect of adding a target.
4747
expect(button.allTargets).toEventuallyNot( beEmpty() )
4848

@@ -58,7 +58,7 @@ class BindToTests: QuickSpec {
5858
called = true
5959
return .empty()
6060
})
61-
item.rx.bindTo(action: action, input: "Hi there!")
61+
item.rx.bind(to: action: action, input: "Hi there!")
6262

6363
_ = item.target!.perform(item.action!, with: item)
6464

@@ -72,7 +72,7 @@ class BindToTests: QuickSpec {
7272
assertionFailure()
7373
return .empty()
7474
})
75-
button.rx.bindTo(action: action, input: "Hi there!")
75+
button.rx.bind(to: action: action, input: "Hi there!")
7676
// Setting the action has an asynchronous effect of adding a target.
7777
expect(button.allTargets).toEventuallyNot( beEmpty() )
7878

@@ -89,7 +89,7 @@ class BindToTests: QuickSpec {
8989
called = true
9090
return .empty()
9191
})
92-
item.rx.bindTo(action: action, input: "Hi there!")
92+
item.rx.bind(to: action: action, input: "Hi there!")
9393

9494
item.rx.unbindAction()
9595
_ = item.target?.perform(item.action!, with: item)

0 commit comments

Comments
 (0)