π
01/15/2019
π 15 days until launch
π₯ 14 day streak
π° $4.99 price (this keeps changing)
π€ $0 revenue
π 0 customers
βοΈ 11.5 hours spent
π» 20 files changed, 1289 insertions(+), 171 deletions(-)
π Today's goal: Search
1:21 PM
Going to have to start after work again, I really need to start going to bed earlier.
6:50 PM
Alright, back at it, search here we go.
8:14 PM
Took a lot longer than I thought it would. Wait, I'm pretty sure I write that every fricken' time. I managed to figure out a few things that were bothering me today. My custom cell view was not working at all. It just showed the same text cell and nothing else, but it's working now π And I got the search working. Check it:
I was curious about memory usage too, I noticed that after I open up every view, and try out a few things like search, adding a new password, it appears to hover around ~28 MB of memory. I feel like that's an improvement over electron πͺ. I've aleady spent almost 2 hours on this again tonight. Gotta log off. It was fun though figuring out how to get the search field working, less fun re-doing the table cell view in storyboard (not to mention setting the height in code). Oh speaking of code, here's one way to get a search field and a table view to talk to each other:
func controlTextDidChange(_ obj: Notification) {
if obj.object as? NSSearchField == searchField {
filterWithString(searchField.stringValue)
}
}
func filterWithString(_ searchFieldValue: String) {
if searchFieldValue.count > 0 {
logins = rows?.filter { r in
return (r[login.name]?.lowercased().contains(searchFieldValue.lowercased()))! ||
(r[login.username]?.lowercased().contains(searchFieldValue.lowercased()))! ||
(r[login.email]?.lowercased().contains(searchFieldValue.lowercased()))!
}
} else {
logins = Array(try! db.prepare(login.table))
}
if(logins?.count == 1) {
tableView.selectRowIndexes(NSIndexSet(index: 0) as IndexSet, byExtendingSelection: false)
}
tableView.reloadData()
}
Oh and don't forget to set the search field's delegate searchField.delegate = self
for that controlTextDidChange
function. Tune in again tomorrow, same time (more or less), same place.
Top comments (0)