lundi 29 juin 2015

Referencing directories within an Xcode project for an iOS app

I need to be able to reference specific files within a directory inside of my xCode project. 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