Minor tweaks

This commit is contained in:
Sindre Sorhus 2020-09-27 13:01:31 +02:00
parent 93fbdf7f09
commit d328da99d5
2 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.3
import PackageDescription
let package = Package(

View File

@ -140,6 +140,7 @@ extension UserDefaults {
- Note: This only removes user-defined entries. System-defined entries will remain.
*/
public func removeAll() {
// We're not using `.removePersistentDomain(forName:)` as it requires knowing the suite name and also because it doesn't emit change events for each key, but rather just `UserDefaults.didChangeNotification`, which we don't subscribe to.
for key in dictionaryRepresentation().keys {
removeObject(forKey: key)
}