Skip to content

Instantly share code, notes, and snippets.

@ariok
Last active August 29, 2015 14:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariok/4442721559013780b8bf to your computer and use it in GitHub Desktop.
Save ariok/4442721559013780b8bf to your computer and use it in GitHub Desktop.
[swift]Extensions to help code readability
import UIKit
class ViewController: UIViewController {
@IBOutlet var searchBar:UISearchBar
@IBOutlet var tableView:UITableView
override func viewDidLoad() {
super.viewDidLoad()
}
}
extension ViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int{
return 10
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!{
let cell:DBTableViewCell = tableView.dequeueReusableCellWithIdentifier("dataCell") as DBTableViewCell
cell.labelName.text = "Ciao Ciao!"
return cell
}
}
extension ViewController: UISearchBarDelegate{
// Your search bar delegate implementation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment