Latest 0.1
License MIT
Platforms ios 9.0
Dependencies InfiniteLayout/Rx

CI Status

RxInfinitePicker is an iOS infinite picker based on RxSwift, it helps you to create a infinite picker using a customized cell.
Using RxInfinitePicker requires the base RxSwift ( knowledge.


To run the example project, clone the repo, and run pod install from the Example directory first.


RxInfinitePicker is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RxInfinitePicker'

Customized cell

The following code is a demo of a customized cell.
A customized cell class NumberPickerCell is a subclass of the generic class RxInfinitePickerCell.
Int is the model type of this customized cell.

class NumberPickerCell: RxInfinitePickerCell<Int> {

    private lazy var numberLabel: UILabel = {
        let label = UILabel()
        label.textColor = .white
        label.textAlignment = .center
        label.font = UIFont.systemFont(ofSize: 23, weight: .bold)
        return label

    override init(frame: CGRect) {
        super.init(frame: frame)


    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")

    override var model: Int? {
        didSet {
            guard let number = model else {
            numberLabel.text = String(number)

    // ...


Using RxInfinitePicker

Create a picker in your view controller class.
The generic type must be same as which in your customized class.

private lazy var numberPicker: RxInfinitePicker<Int> = {
    let picker = RxInfinitePicker<Int>(
        itemSize: CGSize(width: 50, height: 50),
        scrollDirection: .vertical,
        cellType: NumberPickerCell.self
    picker.itemSelected.subscribe(onNext: { [unowned self] in
        print("itemSelected ($0)")
    }).disposed(by: disposeBag)
    return picker

Bind your data to the picker.

override func viewDidLoad() {

    viewModel.items.bind(to: numberPicker.items).disposed(by: disposeBag)

After scrolling or selecting a new item, the itemSelected signal that contains the selected model will be updated.


lm2343635, [email protected]


RxInfinitePicker is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "RxInfinitePicker",
    "version": "0.1",
    "summary": "An iOS infinite picker based on RxSwift.",
    "description": "RxInfinitePicker is an iOS infinite picker based on RxSwift, it helps you to create a infinite picker using a customized cell.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "lm2343635": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1"
    "platforms": {
        "ios": "9.0"
    "source_files": "RxInfinitePicker/Classes/**/*",
    "dependencies": {
        "InfiniteLayout/Rx": [
            "~> 0.2"

Pin It on Pinterest

Share This