xcode - Extract Map Annotations from Plist swift -
firstly, have found loads covering issue on stackoverflow objectivec , not swift.
can provide link, or share code explain how extract annotations information plist?
my plist is...
<?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <array> <dict> <key>name</key> <string>london eye</string> <key>location</key> <string>{51.503324,-0.119543}</string> </dict> <dict> <key>name</key> <string>big ben</string> <key>location</key> <string>{51.500729,-0.124625}</string> </dict> </array> </plist>
using map kit, xcode , swift.
so far view controller contains code obtain users position , allow user add custom annotation
many in advance
for load file plist
var dict: nsdictionary = nsdictionary() // load file dict if let path = nsbundle.mainbundle().pathforresource("name_file", oftype: "plist") { dict = nsdictionary(contentsoffile: path) } var array = dict["array"] as! nsmutablearray item in array { if let dic = item as? nsdictionary { print(dic["key"] as! string) } }
Comments
Post a Comment