Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Add demo of select
Browse files Browse the repository at this point in the history
  • Loading branch information
3lvis committed Jan 9, 2017
1 parent d4477e9 commit a06dacb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SwiftDemo/TableViewController/TableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,15 @@ class TableViewController: UITableViewController {
func saveAction() {
Helper.addNewUser(dataStack: self.dataStack)
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)

let item = self.dataSource.object(indexPath)

let name = item?.value(forKey: "name") as? String ?? ""
let alert = UIAlertController(title: "Selected object", message: name, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

0 comments on commit a06dacb

Please sign in to comment.