Skip to content

Instantly share code, notes, and snippets.

@tudormunteanu
Last active June 11, 2017 16:02
Show Gist options
  • Save tudormunteanu/0b6382613946f3a38a390c4aaf596734 to your computer and use it in GitHub Desktop.
Save tudormunteanu/0b6382613946f3a38a390c4aaf596734 to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
import UIKit
/*
Goals
- refactor UITableView to have sections
- style the UITableViewCell s
- let the user choose a date by using a UIPickerView built based on dates retrieving
*/
var str = "Hello, playground"
var headers = ["robbery", "other-crime"]
var crimes = [
[1, 2, 3, 4], // index 0, just as "robbery"
[5, 6, 7, 8] // index 1, just as "other-crime"
]
let indexPath = NSIndexPath(row: 1, section: 1)
let header = headers[indexPath.section]
// A single crime required inside tableView:cellForRowAtIndexPath:
let crime = crimes[indexPath.section][indexPath.row]
UITableViewDataSource
func numberOfSections(in tableView: UITableView) -> Int {
return crimes.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return crimes[section].count
return 0
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment