2014-06-05 128 views
0

有沒有人想過如何在Swift中將plist讀入數組或字典?我似乎無法弄清楚。我習慣了DictionaryWithContentsOfFile,但是這看起來並沒有在swift中可用。快速閱讀pList

+1

閱讀此頁 https://stackoverflow.com/questions/24045570/swift-read-plist?rq=1 – Maggick

回答

18

看到這個問題的答案:Swift - Read plist

let path = NSBundle.mainBundle().pathForResource("Config", ofType: "plist") 
let dict = NSDictionary(contentsOfFile: path!)