I want to get NSBundle reference from Path in swift.
Like in Objective-c >
NSBundle* languageBundle = [NSBundle bundleWithPath:path];
How we can achieve same in swift .
Try this
var path = NSBundle.mainBundle()//path until your project name.app
var pathForFile = NSBundle.mainBundle().pathForResource("Filename", ofType: "db")// path of your file in bundle
Swift 4:
var pathForFile = Bundle.main.path(forResource: "Filename", ofType: "db")
This way you can do that in swift:
let languageBundle = NSBundle(path: path)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With