func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.patientData.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let identifier = "patientInfoCell"
var cell = tableView.dequeueReusableCell(withIdentifier: identifier) as? PatientInfoTableVC
if cell == nil {
let nib = Bundle.main.loadNibNamed("PatientInfoTableVC", owner: self, options: nil)
cell = nib?[0] as? PatientInfoTableVC
}
cell!.selectionStyle = .none;
return cell!
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 55.0
}
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let editAction:UITableViewRowAction = UITableViewRowAction(style: .normal, title: "Edit") { (action:UITableViewRowAction, indexPath:IndexPath) in
self.patientID = (self.patientData[indexPath.row] as AnyObject).value(forKey: "patient_id") as? String
}
editAction.backgroundColor = UIColor.init(red: 108.0/255.0, green: 110.0/255.0, blue: 112.0/255.0, alpha: 1.0)
let deleteAction:UITableViewRowAction = UITableViewRowAction(style: .normal, title: "Delete") { (action:UITableViewRowAction, indexPath:IndexPath) in
print("Delete Clicked")
}
deleteAction.backgroundColor = UIColor.init(red: 85.0/255.0, green: 198.0/255.0, blue: 227.0/255.0, alpha: 1.0)
return [editAction,deleteAction]
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
}