make additional information ordered

This commit is contained in:
Bob Sun 2017-02-06 22:14:42 +08:00
parent 59eb4af8bb
commit 105573b8a1
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
2 changed files with 23 additions and 11 deletions

View file

@ -69,17 +69,16 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
var tableDataIndex = 0
self.tableData.append(TableSection(title: "", item: []))
if let username = self.password.additions["Username"] {
self.tableData[tableDataIndex].item.append(TableCell(title: "username", content: username))
self.password.additions.removeValue(forKey: "Username")
if self.password.username != "" {
self.tableData[tableDataIndex].item.append(TableCell(title: "username", content: self.password.username))
}
self.tableData[tableDataIndex].item.append(TableCell(title: "password", content: self.password.password))
if self.password.additions.count > 0 {
self.tableData.append(TableSection(title: "additions", item: []))
tableDataIndex += 1
for (key, value) in self.password.additions {
self.tableData[tableDataIndex].item.append(TableCell(title: key, content: value))
for addition in self.password.additions {
self.tableData[tableDataIndex].item.append(TableCell(title: addition.title, content: addition.content))
}
}
DispatchQueue.main.async {