Skip to content

Instantly share code, notes, and snippets.

@dornad
Last active February 17, 2017 18:59
Show Gist options
  • Save dornad/d2cff3394153ac281b2f31324340c3c7 to your computer and use it in GitHub Desktop.
Save dornad/d2cff3394153ac281b2f31324340c3c7 to your computer and use it in GitHub Desktop.
class MovieTableViewController : UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(MovieCell.self, forCellReuseIdentifier: "MovieCell")
}
}
extension MovieTableViewController {
override func numberOfSections(in tableView: UITableView) -> Int {
return 0
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MovieCell", for: indexPath) as! MovieCell
return cell
}
}
class MovieCell : UITableViewCell {
}
// JSON Structure
let json = {
[
{
"poster_path": "/tvSlBzAdRE29bZe5yYWrJ2ds137.jpg",
"release_date": "1977-05-25",
"id": 11,
"title": "Star Wars",
},
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment