Latest 0.5.0
Homepage https://github.com/mateuszfidosBLStream/MFRevealCell
License MIT
Platforms ios 9.0
Authors

Version
License
Platform

Example

To run the example project, clone the repo, open and run Example scheme.

Requirements

ARC
iOS9

Installation

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

pod "MFRevealCell"

Usage

Start with some importing:

import MFRevealCell

Usage:
Register cell class (there is a tableView extension created for this) by calling:

  tableView.registerCell(ofType: WLRevealTableViewCell.self)

you can do it like so:

      @IBOutlet var tableView: UITableView! {
        didSet {
            tableView.registerCell(ofType: WLRevealTableViewCell.self)
        }
    }

Be sure to provide proper data source!

Create reveal option items that you wan’t to use in your cell. You can use one of the defined types with default images/titles or
create items with your custom background color, title and image. (if those custom values are nil, default framework values will be passed instead!)

Configure your cell inside method:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueCell(ofType: WLRevealTableViewCell.self)

        let user = items[indexPath.row]

        cell.titleLabel.text = user.name
        cell.subtitleLabel.text = user.sureName

        let delete = WLRevealOptionItem(type: .delete)
        let share = WLRevealOptionItem(type: .share)
        let edit = WLRevealOptionItem(type: .edit)

        cell.configureWith(delegate: self, items: [delete, share, edit])

        return cell
    }

Be sure to register your view controller to be MFRevealCell delegate to receive callbacks when options close/open and action was pressed

Example on how to handle reseting previous edited cell state:

func didOpen(cell: WLRevealTableViewCell) {
print("did open cell options")
guard let previousEditedCell = editingCell else {
editingCell = cell
return
}

if (previousEditedCell != cell) {
editingCell = cell
previousEditedCell.closeCell()
}
}

Author

Mateusz Fidos, [email protected]

License

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

Latest podspec

{
    "name": "MFRevealCell",
    "version": "0.5.0",
    "summary": "Custom UITableViewCell form my private project that I decided to turn into separate component and share with You",
    "description": "Custom UITableViewCell that lets you add custom icon and title as "row action". Built as part of my own private project. Decided to make it more flexible and share it with You.",
    "homepage": "https://github.com/mateuszfidosBLStream/MFRevealCell",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Mateusz Fidos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mateuszfidosBLStream/MFRevealCell.git",
        "tag": "0.5.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "MFRevealCell/*"
}

Pin It on Pinterest

Share This