Latest 2.1
License MIT
Platforms ios 8.0



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

pod "SelectableView"

If you used use_framework in your podfile just simply do:

import SelectableView

for every file when you need to use it.

you may also use:

@import SelectableView;

within bridging header file and avoid to import framework for every needed file.


  • entirely written in latest Swift syntax.


Simply add SingleSelectableView, MultiSelectableView or SearchSelectableView as a subclass of your UIView in Interface Builder.

Connect following @IBOutlets:

@IBOutlet open var switchButton: UIButton?
@IBOutlet open var contentOptionsHeightConstraint: NSLayoutConstraint?
@IBOutlet open var contentOptionsView: UIView?
@IBOutlet open var selectedOptionLabel: UILabel? //only SingleSelectableView
@IBOutlet open var verticalTokenView: VerticalTokenView? //only MultiSelectableView
@IBOutlet open var horizontalTokenView: HorizontalTokenView?  //only MultiSelectableView
@IBOutlet open var tokenViewHeightConstraint: NSLayoutConstraint? //only MultiSelectableView, useful within UIScrollView
@IBOutlet open var textField: UITextField! //only SearchSelectableView

Assing delegates for your selectable views in viewDidLoad():

singleSelectableView.delegate = self
multiSelectableView.delegate = self
searchSelectableView.delegate = self

Conform your UIViewController to SelectableViewDelegate declared as following:

@objc public protocol SelectableViewDelegate {

    @objc optional func multiSelectableView(_ view: MultiSelectableView, tokenViewFor option: SelectableOption) -> UIView

    @objc optional func singleSelectableView(_ view: SingleSelectableView, didSelect option: SelectableOption)
    @objc optional func multiSelectableView(_ view: MultiSelectableView, didSelect option: SelectableOption)
    @objc optional func searchSelectableView(_ view: SearchSelectableView, didSelect option: SelectableOption)
    @objc optional func selectableViewDidToggleOptions(with button: UIButton, expanded: Bool)

Additionally in Interface Builder you may set up for every SelectableView the following properties:

    var fontForOption = UIFont.systemFont(ofSize: 16)
    var fontForPlaceholderText = UIFont.systemFont(ofSize: 14)

    @IBInspectable open var leftPaddingForPlaceholderText = 0
    @IBInspectable open var leftPaddingForOption = 20
    @IBInspectable open var heightForOption = 40

    @IBInspectable open var titleColorForSelectedOption =
    @IBInspectable open var titleColorForOption =
    @IBInspectable open var textColorForPlaceholderText = UIColor.gray
    @IBInspectable open var tintColorForSelectedOption =

    @IBInspectable open var identifier = ""
    @IBInspectable open var tableViewAccessibilityIdentifier = ""
    @IBInspectable open var maxNumberOfRows = 6
    @IBInspectable open var placeholder = ""

If you need you are able to call public instance methods:

open func hideOptions() //collapse selectable options
open func select(option: SelectableOption) //only MultiSelectableView
open func deselect(option: SelectableOption) //only MultiSelectableView

You have access to the following properties:

open var options: [SelectableOption]? //current list of options able to select it
open var selectedOption: SelectableOption? //SingleSelectableView, SearchSelectableView
open var selectedOptions = [SelectableOption]() //MultiSelectableView

SelectableOption is defined as follows:

open class SelectableOption: NSObject {

    open var index: Int
    open var identifier: String
    open var title: String
    open var userInfo: [AnyHashable: Any]?

    open var descendantOptions = [SelectableOption]()

    public init(index: Int, title: String, identifier: String, userInfo: [AnyHashable: Any]? = nil) {

        self.index = index
        self.identifier = identifier
        self.title = title
        self.userInfo = userInfo


Bartłomiej Semańczyk, [email protected]


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

Latest podspec

    "name": "BSSelectableView",
    "version": "2.1",
    "summary": "Easily manage your token along with your single or multiply select view.",
    "description": "Looking for simple Swift library to manage multiply or single selection? This one is for you:)",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Bartu0142omiej Semau0144czyk": "[email protected]"
    "source": {
        "git": "",
        "tag": "2.1"
    "platforms": {
        "ios": "8.0"
    "source_files": "SelectableView/Classes/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This