Created
February 13, 2017 14:07
-
-
Save yoman07/5b56a02f0390cdd4afeccebc2f979512 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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