Trust in assigned default value

In particular, SwiftyUserDefaults returns the default value in case it does not find a value in the dictionary. As the default is '.all' it does not have to be set explicitly. Assigning 'nil' will result in '.all' anyway.
This commit is contained in:
Danny Moesch 2019-05-04 22:15:23 +02:00
parent 4b3e424bb3
commit 44870af774
2 changed files with 2 additions and 2 deletions

View file

@ -585,7 +585,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {
// update the default search scope
SharedDefaults[.searchDefault] = SearchBarScope(rawValue: selectedScope) ?? .all
SharedDefaults[.searchDefault] = SearchBarScope(rawValue: selectedScope)
updateSearchResults(for: searchController)
}