Latest 0.0.2
Homepage https://github.com/kaskay/LimitCellSelect
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit
Authors

Version
Carthage Compatible
License: MIT
Platform
Swift 3.0

Intoduction

demo

You can specify the maximum number of cells that can be selected, and specify the cells that are selected by default.

Requirements

LimitCellSelect is written in Swift 3. Compatible with iOS 9.0+

Usage

import Library

import LimitCellSelect

initial Limit and default select index

To limit the number of cell selections and preselect a cell

limitCellSelect = LimitCellSelect.init(limit: 3, defaultIndex: [0,2])

or If you do not use defaultSelect

limitCellSelect = LimitCellSelect.init(limit: 3)

And when the cell is created, it is set by using the set () method.

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = UITableViewCell(style: .default, reuseIdentifier: "reuseIdentifier")

        // Setting limitCellSelect
        limitCellSelect.set(cell: cell, row: indexPath.row)

        return cell
    }

To select a cell and return the selected cell, use the on () and selectCells () methods.

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        guard let cell  = tableView.cellForRow(at: indexPath) else { return }

        //Checks the currently selected cell.
        limitCellSelect.on(cell: cell, row: indexPath.row)

        //Returns the selected cells.
        print(limitCellSelect.selectCells())
    }

Installation

Cocoapods

LimitCellSelect is available through CocoaPods.

pod 'LimitCellSelect'

Carthage

LimitCellSelect is available through Carthage.

github "https://github.com/kaskay/LimitCellSelect"

Author

kaskay

License

LimitCellSelect is available under the MIT license.

Latest podspec

{
    "name": "LimitCellSelect",
    "version": "0.0.2",
    "summary": "LimitCellSelect.",
    "description": "limited button select, written in Swift 3.",
    "homepage": "https://github.com/kaskay/LimitCellSelect",
    "license": {
        "type": "MIT",
        "file": "FILE_LICENSE"
    },
    "authors": {
        "jeasung.lee": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/kaskay/LimitCellSelect.git",
        "tag": "0.0.2"
    },
    "source_files": "LimitCellSelect/**/*.swift",
    "frameworks": "UIKit",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This