Thursday, January 5, 2017

Access resource from main bundle using Swift 3.0


Plist read from the main bundle:

let plistPath = Bundle.main.path(forResource: "plist name", ofType: "plist")
let dataList = :NSArray = NSArray(contentsOfFile: plistPath!)!
print(dataList)

Info Plist access:

let appDisplayName:String = Bundle.main.infoDictionary!["CFBundleDisplayName"] as! String


No comments:

Post a Comment