Skip to content

Commit af828c2

Browse files
authored
Merge pull request #20 from demchenkoalex/feature/update-syntax
Feature/update syntax
2 parents b937187 + be22152 commit af828c2

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "ReactiveX/RxSwift" >= 3.0
1+
github "ReactiveX/RxSwift" >= 3.4

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "ReactiveX/RxSwift" "3.0.0"
1+
github "ReactiveX/RxSwift" "3.4.0"

Example/Sources/ViewControllers/MessageListViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ class MessageListViewController: UIViewController {
102102
self.view.layoutIfNeeded()
103103
}
104104
})
105-
.addDisposableTo(self.disposeBag)
105+
.disposed(by: self.disposeBag)
106106

107107
RxKeyboard.instance.willShowVisibleHeight
108108
.drive(onNext: { keyboardVisibleHeight in
109109
self.collectionView.contentOffset.y += keyboardVisibleHeight
110110
})
111-
.addDisposableTo(self.disposeBag)
111+
.disposed(by: self.disposeBag)
112112

113113
self.messageInputBar.rx.sendButtonTap
114114
.subscribe(onNext: { [weak self] text in
@@ -119,7 +119,7 @@ class MessageListViewController: UIViewController {
119119
self.collectionView.insertItems(at: [indexPath])
120120
self.collectionView.scrollToItem(at: indexPath, at: [], animated: true)
121121
})
122-
.addDisposableTo(self.disposeBag)
122+
.disposed(by: self.disposeBag)
123123
}
124124

125125

Example/Sources/Views/MessageInputBar.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ final class MessageInputBar: UIView {
6161

6262
self.textView.rx.text
6363
.map { text in text?.isEmpty == false }
64-
.bindTo(self.sendButton.rx.isEnabled)
65-
.addDisposableTo(self.disposeBag)
64+
.bind(to: self.sendButton.rx.isEnabled)
65+
.disposed(by: self.disposeBag)
6666
}
6767

6868
required init?(coder aDecoder: NSCoder) {

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RxKeyboard.instance.frame
4040
.drive(onNext: { frame in
4141
print(frame)
4242
})
43-
.addDisposableTo(disposeBag)
43+
.disposed(by: disposeBag)
4444
```
4545

4646
## Tips and Tricks
@@ -52,7 +52,7 @@ RxKeyboard.instance.frame
5252
.drive(onNext: { keyboardVisibleHeight in
5353
scrollView.contentInset.bottom = keyboardVisibleHeight
5454
})
55-
.addDisposableTo(disposeBag)
55+
.disposed(by: disposeBag)
5656
```
5757

5858
- <a name="tip-content-offset" href="#tip-content-offset">🔗</a> **I want to adjust `UIScrollView`'s `contentOffset` to fit keyboard height.**
@@ -62,7 +62,7 @@ RxKeyboard.instance.frame
6262
.drive(onNext: { keyboardVisibleHeight in
6363
scrollView.contentInset.offset.y += keyboardVisibleHeight
6464
})
65-
.addDisposableTo(disposeBag)
65+
.disposed(by: disposeBag)
6666
```
6767

6868
- <a name="tip-toolbar" href="#tip-toolbar">🔗</a> **I want to make `UIToolbar` move along with the keyboard in an interactive dismiss mode. (Just like the wonderful GIF above!)**
@@ -74,7 +74,7 @@ RxKeyboard.instance.frame
7474
.drive(onNext: { keyboardVisibleHeight in
7575
toolbar.frame.origin.y = self.view.height - toolbar.frame.height - keyboardVisibleHeight
7676
})
77-
.addDisposableTo(disposeBag)
77+
.disposed(by: disposeBag)
7878
```
7979

8080
If you're using Auto Layout, you have to capture the toolbar's bottom constraint and set `constant` to keyboard visible height.
@@ -84,7 +84,7 @@ RxKeyboard.instance.frame
8484
.drive(onNext: { keyboardVisibleHeight in
8585
toolbarBottomConstraint.constant = -1 * keyboardVisibleHeight
8686
})
87-
.addDisposableTo(disposeBag)
87+
.disposed(by: disposeBag)
8888
```
8989

9090
> **Note**: In real world, you should use `setNeedsLayout()` and `layoutIfNeeded()` with animation block. See the [example project](https://github.com/RxSwiftCommunity/RxKeyboard/blob/master/Example/Sources/ViewControllers/MessageListViewController.swift#L92-L105) for example.
@@ -93,8 +93,8 @@ RxKeyboard.instance.frame
9393

9494
## Dependencies
9595

96-
- [RxSwift](https://github.com/ReactiveX/RxSwift) (>= 3.0)
97-
- [RxCocoa](https://github.com/ReactiveX/RxSwift) (>= 3.0)
96+
- [RxSwift](https://github.com/ReactiveX/RxSwift) (>= 3.4)
97+
- [RxCocoa](https://github.com/ReactiveX/RxSwift) (>= 3.4)
9898

9999
## Requirements
100100

RxKeyboard.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
1111
s.frameworks = 'UIKit', 'Foundation'
1212
s.requires_arc = true
1313

14-
s.dependency 'RxSwift', '>= 3.0'
15-
s.dependency 'RxCocoa', '>= 3.0'
14+
s.dependency 'RxSwift', '>= 3.4'
15+
s.dependency 'RxCocoa', '>= 3.4'
1616

1717
s.ios.deployment_target = '8.0'
1818

Sources/RxKeyboard.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public class RxKeyboard: NSObject {
104104

105105
// merge into single sequence
106106
Observable.of(didPan, willChangeFrame, willHide).merge()
107-
.bindTo(frameVariable)
108-
.addDisposableTo(self.disposeBag)
107+
.bind(to: frameVariable)
108+
.disposed(by: self.disposeBag)
109109

110110
// gesture recognizer
111111
self.panRecognizer.delegate = self
@@ -115,7 +115,7 @@ public class RxKeyboard: NSObject {
115115
.subscribe(onNext: { _ in
116116
UIApplication.shared.windows.first?.addGestureRecognizer(self.panRecognizer)
117117
})
118-
.addDisposableTo(self.disposeBag)
118+
.disposed(by: self.disposeBag)
119119
}
120120

121121
}

0 commit comments

Comments
 (0)