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:
parent
4b3e424bb3
commit
44870af774
2 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public extension DefaultsKeys {
|
|||
static let isRememberGitCredentialPassphraseOn = DefaultsKey<Bool>("isRememberGitCredentialPassphraseOn", defaultValue: false)
|
||||
static let isShowFolderOn = DefaultsKey<Bool>("isShowFolderOn", defaultValue: true)
|
||||
static let isHidePasswordImagesOn = DefaultsKey<Bool>("isHidePasswordImagesOn", defaultValue: false)
|
||||
static let searchDefault = DefaultsKey<SearchBarScope>("searchDefault", defaultValue: .all)
|
||||
static let searchDefault = DefaultsKey<SearchBarScope?>("searchDefault", defaultValue: .all)
|
||||
static let passwordGeneratorFlavor = DefaultsKey<String>("passwordGeneratorFlavor", defaultValue: "Apple")
|
||||
|
||||
static let encryptInArmored = DefaultsKey<Bool>("encryptInArmored", defaultValue: false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue