0
class func findProfessions() -> [PhotoProfession] {
var professions = [PhotoProfession]()
let backendless = Backendless.sharedInstance()
if let p = backendless.data.of(Profession.ofClass()).find() {
for prof in p.data {
let photo = PhotoProfession(title: (prof as! Profession).name!)
let pathImage = (prof as! Profession).pathIcon!
_ = PhotoProfession.getNetworkImage(pathImage) { image in
photo.image = image!.decompressedImage
}
professions.append(photo)
}
}
return professions
}
class func getNetworkImage(urlString: String, completion: (UIImage? -> Void)) -> (Request) {
return Alamofire.request(.GET, urlString).response {
(_, _, data, _) in
let image = UIImage(data: data! as NSData)
completion(image)
}
}