Skip to content

Instantly share code, notes, and snippets.

@e-sung
Created May 9, 2019 14:24
Show Gist options
  • Save e-sung/6d3af00964c65b94a28ae3aa8df7695d to your computer and use it in GitHub Desktop.
Save e-sung/6d3af00964c65b94a28ae3aa8df7695d to your computer and use it in GitHub Desktop.
class SmileyDataSource: NSObject, UITableViewDataSource {
var dataList: [String] = []
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = dataList[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: "smileyCell", for: indexPath)
cell.textLabel?.text = item
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment