Created
July 31, 2015 00:39
-
-
Save terrybu/3d42e33aa8a90c1189f7 to your computer and use it in GitHub Desktop.
Boilerplate cellForRowAtIndexPath with reuse identifier - Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private let cellReuseIdentifier: String = "yourCellReuseIdentifier" | |
// | |
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
var cell : UITableViewCell? = tableView.dequeueReusableCellWithIdentifier(cellReuseIdentifier) as? UITableViewCell | |
if (cell == nil) { | |
cell = UITableViewCell(style:.Default, reuseIdentifier:cellReuseIdentifier) | |
} | |
cell!.textLabel!.text = "Hello World" | |
return cell! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment