Skip to content

Instantly share code, notes, and snippets.

@cacheleocode
Created March 19, 2018 08:14
Show Gist options
  • Save cacheleocode/a6dd782fb851d232284baa22e6ad1dc0 to your computer and use it in GitHub Desktop.
Save cacheleocode/a6dd782fb851d232284baa22e6ad1dc0 to your computer and use it in GitHub Desktop.
if let url = Bundle.main.url(forResource:"Channels", withExtension: "plist") {
do {
var data = try Data(contentsOf:url)
let swiftDictionary = try PropertyListSerialization.propertyList(from: data, options: [], format: nil) as! [String:Any]
// do something with the dictionary
// debugPrint(swiftDictionary)
for (key, values) in swiftDictionary {
print(key)
}
// data.append((swiftDictionary as AnyObject).object("name") as! String)
} catch {
print(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment