diff --git a/Sources/Classes/Controllers/BaseScrollContentController.swift b/Sources/Classes/Controllers/BaseScrollContentController.swift index 71a24404..6c1ea683 100644 --- a/Sources/Classes/Controllers/BaseScrollContentController.swift +++ b/Sources/Classes/Controllers/BaseScrollContentController.swift @@ -34,10 +34,9 @@ open class BaseScrollContentController: B /// /// - Parameter bottomInsetDriver: Driver that emits CGFloat bottom inset changes. public func bindBottomInsetBinding(from bottomInsetDriver: Driver) { - let contentInsetObservable = customView.scrollView.rx - .observe(UIEdgeInsets.self, #keyPath(UIScrollView.contentInset)) + let contentInsetObservable = customView.scrollView.rx.contentOffset - let bottomInset = contentInsetObservable.map { $0?.bottom ?? 0 } + let bottomInset = contentInsetObservable.map { $0.y } bottomInsetDisposable = bottomInsetDriver.asObservable() .withLatestFrom(bottomInset) { $0 + $1 } diff --git a/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift b/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift index 5b5be346..c748aaf1 100644 --- a/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift +++ b/Sources/Extensions/UIKit/UIScrollView/UIScrollView+RxBindings.swift @@ -28,12 +28,8 @@ public extension Reactive where Base: UIScrollView { /// Binder instance that updates contentInset bottom value. var bottomInsetBinder: Binder { return Binder(base) { base, value in - // Quick workaround. - // For some reason code in closure won't work without async call. - DispatchQueue.main.async { - base.contentInset.bottom = value - base.scrollIndicatorInsets.bottom = value - } + base.contentInset.bottom = value + base.scrollIndicatorInsets.bottom = value } } }