Latest 0.2
Homepage https://github.com/arturjaworski/TableViewManager
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

Version
License
Platform

Description

Pod registers cells (Nibs and dynamic one) and allows you to handle all UITableViewCells with enum. Written in Swift.

Installation

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

pod "TableViewManager"

Quick Start (in 3 steps!)

Step 1

Remember about import TableViewManager. Make sure that ViewController is your UITableView’s data source.

Step 2

Implemment tableView(_:cellForRowAtIndexPath:) as below.

extension ViewController: UITableViewDataSource {
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        return self.tableViewManager(tableView, cellForRowAtIndexPath: indexPath)
    }

    // (...)
}

Step 3

Implemment TableViewManager protocol.

extension ViewController: TableViewManager, EnumTableViewManager {
    // Cell identifier should be the same as you set in .xib or storyboard file.
    enum TableViewCellsIdentifiers: String {
        case TextTableViewCell
        case ImageTableViewCell
    }

    // Return cell indentifier for provided indexPath
    func tableView(tableView: UITableView, cellIdentifierForIndexPath indexPath: NSIndexPath) -> TableViewCellsIdentifiers {
        return .TextTableViewCell
    }

    // Configure cell as before in tableView(_:cellForRowAtIndexPath:)
    func tableView(tableView: UITableView, configureCell cell: UITableViewCell, forIndexPath indexPath: NSIndexPath) {
        if let cell = cell as? TextTableViewCell {
            cell.myLabel.text = "Lorem Ipsum"
        }
    }

    // Implemment if you want to change default Nib name, which is the same as identifier
    //func tableView(tableView: UITableView, nibNameForCellIdentifier cellIdentifier: TableViewCellsIdentifiers) -> String? {
    //    return nil
    //}
}

That’s all!

You can also use TableViewManager without enum. It could be useful when you creating external data source object.

License

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

Latest podspec

{
    "name": "TableViewManager",
    "version": "0.2",
    "summary": "Using custom UITableViewCell using Nib easier.",
    "description": "Pod registers Nibs and allows you to handle all custom UITableViewCells with enum. Written in Swift.",
    "homepage": "https://github.com/arturjaworski/TableViewManager",
    "license": "MIT",
    "authors": {
        "Artur Jaworski": "[email protected]"
    },
    "source": {
        "git": "https://github.com/arturjaworski/TableViewManager.git",
        "tag": "0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "TableViewManager": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This