I want to translate my current program to Swift and I am getting hung up on the simplest things.
I am trying to read a plist
But I want to do this one at a time.
i.e. - if we are trying to call the image candy hearts.jpg (we obviously need to add the extension jpeg.
This is what I found on on the net.
var myDict: NSDictionary?
if let path = NSBundle.mainBundle().pathForResource("data", ofType: "plist") {
myDict = NSDictionary(contentsOfFile: path)
// self.data
}
if let dict = myDict {
// Use your dict here
}
This is what I originally used iOS6
NSString *pathOfDataTitle = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"];
NSMutableArray *arrayOfTitle = [[NSMutableArray alloc] initWithContentsOfFile:pathOfDataTitle];
self.Datalist = arrayOfTitle;