File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public class RxKeyboard: NSObject, RxKeyboardType {
5757 width: UIScreen . main. bounds. width,
5858 height: 0
5959 )
60- let frameVariable = Variable < CGRect > ( defaultFrame)
60+ let frameVariable = BehaviorRelay < CGRect > ( value : defaultFrame)
6161 self . frame = frameVariable. asDriver ( ) . distinctUntilChanged ( )
6262 self . visibleHeight = self . frame. map { UIScreen . main. bounds. height - $0. origin. y }
6363 self . willShowVisibleHeight = self . visibleHeight
@@ -115,8 +115,10 @@ public class RxKeyboard: NSObject, RxKeyboardType {
115115
116116 // merge into single sequence
117117 Observable . of ( didPan, willChangeFrame, willHide) . merge ( )
118- . bind ( to: frameVariable)
119- . disposed ( by: self . disposeBag)
118+ . subscribe ( onNext: { [ weak frameVariable] frame in
119+ frameVariable? . accept ( frame)
120+ } )
121+ . disposed ( by: self . disposeBag)
120122
121123 // gesture recognizer
122124 self . panRecognizer. delegate = self
You can’t perform that action at this time.
0 commit comments