Skip to content

Commit 2343feb

Browse files
authored
Merge pull request #4 from lm2343635/master
Add scroll reactive extensions.
2 parents 8c644a3 + 0d6a3c9 commit 2343feb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

RxPagingKit/PagingContentViewController+Rx.swift

+6
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ public extension Reactive where Base: PagingContentViewController {
103103
return delegate.willFinishPaging
104104
}
105105

106+
public func scroll(animated: Bool) -> Binder<Int> {
107+
return Binder(self.base) { (controller, index) in
108+
controller.scroll(to: index, animated: animated)
109+
}
110+
}
111+
106112
private var delegate: RxPagingContentViewControllerDelegateProxy {
107113
return RxPagingContentViewControllerDelegateProxy.proxy(for: base)
108114
}

RxPagingKit/PagingMenuViewController+Rx.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ public extension Reactive where Base: PagingMenuViewController {
103103
return delegate.willDisplayCell
104104
}
105105

106+
public var scroll: Binder<Int> {
107+
return Binder(self.base) { (controller, index) in
108+
controller.scroll(index: index)
109+
}
110+
}
111+
106112
private var delegate: RxPagingMenuViewControllerDelegateProxy {
107113
return RxPagingMenuViewControllerDelegateProxy.proxy(for: base)
108114
}
115+
109116
}
110-
111-
112-

0 commit comments

Comments
 (0)