I'm trying to fetch image from its default class to store in my own class model. Image seems to loads okay but it didn't store to my class. here's my code
dataImage model
class dataImage {
var userId: String
var value: Double
var photo: UIImage?
init(userId:String, value: Double, photo: UIImage?){
self.userId = userId
self.value = value
self.photo = photo
}
}
view controller
for asset in photos{
asset.fetchFullScreenImageWithCompleteBlock({ image, info in
let images = image
let data1 = dataImage(userId: "1", value: 1.0, photo: images)
self.datas += [data1]
print("*")
})
}
print("datas: \(datas.count)")
so i have 6 'image' in photos and '*' print 6 times, but datas.count is 0, how to fix this?