MultiSelector is a customizable multiple selector for iOS with RxSwift supported.
MultiSelector is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'MultiSelector'
A customized model for a customized button must contains the title of the button.
If you want to control the isEnabled
property of the button, just add it into your customized model.
struct Model: MultiSelectorModel {
let title: String
let isEnabled: Bool
}
public class Button: MultiSelectorButton {
public override func configure(model: MultiSelectorModel?) {
// customized code.
}
}
multiSelector.buttonType = Button.self
multiSelector.delegate = self
multiSelector.models = [model1, model2, ...]
multiSelector.numberOfSelectableItems = 4
multiSelector.numberOfColumns = 4
multiSelector.verticalSpaceing = 10
multiSelector.horizontalSpacing = 10
extension ViewController: MultiSelectorDelegate {
func didSelectedIndexUpdated(indexes: [Int]) {
}
}
multiSelector.rx.indexesSelected.subscribe(onNext: { [unowned self] in
print($0.map { self.allModels[$0] })
}).disposed(by: disposeBag)
To run the example project, clone the repo, and run pod install
from the Example directory first.
MultiSelector is available under the MIT license. See the LICENSE file for more info.