Skip to content

Instantly share code, notes, and snippets.

@yoman07
Created February 13, 2017 14:07
Show Gist options
  • Save yoman07/5b56a02f0390cdd4afeccebc2f979512 to your computer and use it in GitHub Desktop.
Save yoman07/5b56a02f0390cdd4afeccebc2f979512 to your computer and use it in GitHub Desktop.
import Foundation
extension Dictionary {
static func contentsOf(url: URL) -> Dictionary<Key, Value>? {
do {
let data = try Data(contentsOf:url)
let properties = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [Key: Value]
return properties
} catch {
return nil
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment