Skip to content

Commit 15233ec

Browse files
authored
Merge pull request #1086 from skyline75489/fix/NSUserDefaults-dictionaryRepresentation
2 parents 3a84a0c + a664c77 commit 15233ec

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

CoreFoundation/Preferences.subproj/CFPreferences.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ keysToFetch that are not present in the returned dictionary
9393
are not present in the domain. If keysToFetch is NULL, all
9494
keys are fetched. */
9595
CF_EXPORT
96-
CFDictionaryRef CFPreferencesCopyMultiple(_Nullable CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName);
96+
_Nullable CFDictionaryRef CFPreferencesCopyMultiple(_Nullable CFArrayRef keysToFetch, CFStringRef applicationID, CFStringRef userName, CFStringRef hostName);
9797

9898
/* The primitive set function; all arguments except value must be
9999
non-NULL. If value is NULL, the given key is removed */

Foundation/NSUserDefaults.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,8 @@ open class UserDefaults: NSObject {
239239
}
240240

241241
open func dictionaryRepresentation() -> [String : Any] {
242-
NSUnimplemented()
243-
/*
244-
Currently crashes the compiler.
245242
guard let aPref = CFPreferencesCopyMultiple(nil, kCFPreferencesCurrentApplication, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost),
246-
bPref = (aPref._swiftObject) as? [NSString: Any] else {
243+
let bPref = (aPref._swiftObject) as? [NSString: Any] else {
247244
return registeredDefaults
248245
}
249246
var allDefaults = registeredDefaults
@@ -253,7 +250,6 @@ open class UserDefaults: NSObject {
253250
}
254251

255252
return allDefaults
256-
*/
257253
}
258254

259255
open var volatileDomainNames: [String] { NSUnimplemented() }

0 commit comments

Comments
 (0)