mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
UserDefaults.dictionaryRepresentation
This commit is contained in:
1 parent
f55a8eb82f
commit
1997f9ab9e
1 file changed
+8
-2
@@ -94,6 +94,14 @@ public class UserDefaults {
|
||||
|
||||
// MARK: - Reading Default Values
|
||||
|
||||
public var dictionaryRepresentation: [String: AnyObject] {
|
||||
var dic = registrationDictionary
|
||||
for item in UserDefaultsItem.fetchAll(db) {
|
||||
dic[item.key] = item.value
|
||||
}
|
||||
return dic
|
||||
}
|
||||
|
||||
public func arrayForKey(key: String) -> [AnyObject]? {
|
||||
return objectForKey(key) as? [AnyObject]
|
||||
}
|
||||
@@ -181,6 +189,4 @@ dbQueue.inDatabase { db in
|
||||
defaults.integerForKey("bar") // 0
|
||||
defaults.setInteger(12, forKey: "bar")
|
||||
defaults.integerForKey("bar") // 12
|
||||
defaults.removeObjectForKey("bar")
|
||||
defaults.integerForKey("bar") // 0
|
||||
}
|
||||
Reference in new issue
Block a user