File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public class RxKeyboard: NSObject {
43
43
height: 0
44
44
)
45
45
let frameVariable = Variable < CGRect > ( defaultFrame)
46
- self . frame = frameVariable. asDriver ( )
46
+ self . frame = frameVariable. asDriver ( ) . distinctUntilChanged ( )
47
47
self . visibleHeight = self . frame. map { UIScreen . main. bounds. height - $0. origin. y }
48
48
49
49
super. init ( )
@@ -82,7 +82,8 @@ public class RxKeyboard: NSObject {
82
82
let didPan = self . panRecognizer. rx. event
83
83
. withLatestFrom ( frameVariable. asObservable ( ) ) { ( $0, $1) }
84
84
. flatMap { ( gestureRecognizer, frame) -> Observable < CGRect > in
85
- guard let window = UIApplication . shared. windows. first,
85
+ guard case . changed = gestureRecognizer. state,
86
+ let window = UIApplication . shared. windows. first,
86
87
frame. origin. y < UIScreen . main. bounds. height
87
88
else { return . empty( ) }
88
89
let origin = gestureRecognizer. location ( in: window)
You can’t perform that action at this time.
0 commit comments