https://github.com/gazolla/generictableview-swift
Creates a easily reusable TableViewController.
https://github.com/gazolla/generictableview-swift
generic ios-ui swift-3 tableview
Last synced: 2 months ago
JSON representation
Creates a easily reusable TableViewController.
- Host: GitHub
- URL: https://github.com/gazolla/generictableview-swift
- Owner: gazolla
- Created: 2016-07-17T00:39:14.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-27T01:46:22.000Z (almost 9 years ago)
- Last Synced: 2025-02-01T10:26:12.731Z (4 months ago)
- Topics: generic, ios-ui, swift-3, tableview
- Language: Swift
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GenericTableView-Swift
Creates a easily reusable TableViewController.##Supported Platforms
- iOS 9
- swift 2.2##Installing
In order to install, you'll need to copy the `GenericTableViewController` file into your Xcode project.
##Usage
###Using the ConfigureTable struct constructor:
* items - this is the collection you want to show in the tableview
* cellType - This is the UITableViewCell class you want to use
* configureCell - This is a closure with your cell configuration
* selectedRow - This is a closure that will be fired when a cell is touched```swift
ConfigureTable(items: [Item],
cellType: AnyClass,
configureCell:(cell: UITableViewCell, item: Item) -> (),
selectedRow:(tableView: UITableView, indexPath: NSIndexPath) -> ())
```###Sample:
```swift
let names = ["John", "Clark", "Peter", "Tim", "Zack", "Adam"].sort()
let config = ConfigureTable(items: names,
cellType: UITableViewCell.self,
configureCell: { (cell, item) in
cell.textLabel?.text = "\(item)"
}) { (tableView, indexPath) in
let cell = tableView.cellForRowAtIndexPath(indexPath)
print(cell?.textLabel?.text)
}
let main = GenericTableViewController(config: config)
```##License
`GenericTableViewController` is licensed under the MIT license.