From ae93727c6b6b4ff681ce2fa86d2e8537f42b2de9 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Mon, 13 Feb 2017 11:42:28 +0800 Subject: [PATCH] only prepare saveEditPasswordSegue --- .../EditPasswordTableViewController.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pass/Controllers/EditPasswordTableViewController.swift b/pass/Controllers/EditPasswordTableViewController.swift index af41505..b7a41bb 100644 --- a/pass/Controllers/EditPasswordTableViewController.swift +++ b/pass/Controllers/EditPasswordTableViewController.swift @@ -39,15 +39,17 @@ class EditPasswordTableViewController: PasswordEditorTableViewController { } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - let cells = tableView.visibleCells - var cellContents = [String: String]() - for cell in cells { - let indexPath = tableView.indexPath(for: cell)! - let contentCell = cell as! ContentTableViewCell - let cellTitle = tableData[indexPath.section][indexPath.row][.title] as! String - cellContents[cellTitle] = contentCell.getContent()! + if segue.identifier == "saveEditPasswordSegue" { + let cells = tableView.visibleCells + var cellContents = [String: String]() + for cell in cells { + let indexPath = tableView.indexPath(for: cell)! + let contentCell = cell as! ContentTableViewCell + let cellTitle = tableData[indexPath.section][indexPath.row][.title] as! String + cellContents[cellTitle] = contentCell.getContent()! + } + password!.updatePassword(name: cellContents["name"]!, plainText: "\(cellContents["password"]!)\n\(cellContents["additions"]!)") } - password!.updatePassword(name: cellContents["name"]!, plainText: "\(cellContents["password"]!)\n\(cellContents["additions"]!)") } }