我有一个函数,它是这样的:
fileprivate func setupImageViewWithURL(url: URL) {
var image: UIImage? = nil
do {
try image = UIImage(data: Data(contentsOf: url))!
} catch is NSError {
print("Failed")
}
image = self.imageWithImage(sourceImage: image!, scaledToWidth: UIScreen.main.bounds.size.width)
self.imageImageView.image = image
self.imageImageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: (image?.size.height)!)
}
我希望在后台线程上运行它。
我尝试了Swift2的GDC方法,但没有起作用。
在Swift3中,线程主题是否有任何变化?
谢谢!