FSPagerView+Rx
To run the example project, clone the repo, and run pod install
from the Example directory first.
RxFSPagerView is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'RxFSPagerView'
let items = Driver.of(["image0", "image1", "image2", "image3"])
items.drive(pagerView.rx.items(cellIdentifier: "FSPagerViewCell"))
{ _, item, cell in
cell.imageView?.image = UIImage(named: item)
}.disposed(by: disposeBag)
items.map({ $0.count }).drive(pageControl.rx.numberOfPages).disposed(by: disposeBag)
pagerView.rx.itemSelected.subscribe(onNext: { index in
debugPrint(index)
}).disposed(by: disposeBag)
pagerView.rx.modelSelected(String.self).subscribe(onNext: { image in
debugPrint(image)
}).disposed(by: disposeBag)
pagerView.rx.itemScrolled.asDriver().drive(pageControl.rx.currentPage).disposed(by: disposeBag)
Pircate, gao497868860@163.com
RxFSPagerView is available under the MIT license. See the LICENSE file for more info.