Skip to content

Instantly share code, notes, and snippets.

@lilyball
Created January 17, 2018 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lilyball/de778eca5bbf74076027af457907b590 to your computer and use it in GitHub Desktop.
Save lilyball/de778eca5bbf74076027af457907b590 to your computer and use it in GitHub Desktop.
let dict = UserDefaults.standard.dictionary(forKey: String(key)) ?? [:]
var result = Dictionary<Int,Bool>(minimumCapacity: dict.count)
for (key, value) in dict {
guard let intKey = key as? Int,
let boolValue = value as? Bool
else { continue }
result[intKey] = boolValue
}
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment