Skip to content

Instantly share code, notes, and snippets.

@jemmons
Created November 22, 2014 21:31
Show Gist options
  • Save jemmons/25668e8bf2f87109746f to your computer and use it in GitHub Desktop.
Save jemmons/25668e8bf2f87109746f to your computer and use it in GitHub Desktop.
`returning` for Swift
func returning<T>(object:T, block:(_:T)->Void)->T{
block(object)
return object
}
public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
return returning(tableView.dequeueReusableCellWithIdentifier("Identifier")){ cell in
cell.textLabel.text = "Hello"
cell.detailTextLabel?.text = "World"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment