lundi 29 juin 2015

Finding all of the files within a directory within the main bundle of an iOS app - swift

I have a folder in my Xcode project called data and I need to be able to reference specific files within that directory. So far I have this code:

let files = NSBundle.mainBundle().pathForResource("sampleFile", ofType: "csv")
var contents = String(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: nil)!

Which works to open a single file, but I would like to be able to open a file that is stored inside one or two directories within the main bundle.

Does anybody know how to do this?

Aucun commentaire:

Enregistrer un commentaire