Why am I getting this error? I paste the code, my first attemp broke a thread when in runtime. Gosh, now I see why the first question apple recruiters ask CS students is do you know apple code, or 'swift'...(meh)
The error says - lastPathComponent is unavailable: Use lastPathComponent on NSURL instead
// get a list of all the png files in the app's images group
let paths = NSBundle.mainBundle().pathsForResourcesOfType(
"png", inDirectory: nil)
// get image filenames from paths
for path in paths {
if !path.lastPathComponent.hasPrefix("AppIcon") { //error
allCountries.append(path.lastPathComponent) //error
}
}
Attempt 1:
for path in paths as [AnyObject] {
if !path.lastPathComponent.hasPrefix("AppIcon") {
allCountries.append(path.lastPathComponent)
}
}