I have this code:
DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.default).async {
let url = URL(string: itemImageURL )
let data = try? Data(contentsOf: url!)
if data != nil {
DispatchQueue.main.async{
cell.advImage!.image = UIImage(data: data!)
}
}
}
I get this warning in Swift 3:
'default' was deprecated in iOS 8.0: Use qos attributes instead
on the first line.
Haven't found yet a solution. Has anybody?
try qos: DispatchQoS.QoSClass.default
instead of priority: DispatchQueue.GlobalQueuePriority.default
DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async {
let url = URL(string: itemImageURL )
let data = try? Data(contentsOf: url!)
if data != nil {
DispatchQueue.main.async{
cell.advImage!.image = UIImage(data: data!)
}
}
}
Instead of using priority parameter:
DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.default).async {
// ...
}
use qos
parameter that uses a different enum DispatchQoS.QoSClass.default
but you can also use its enum value as just .default
:
DispatchQueue.global(qos: .default).async {
// ...
}
Swift 3 has brought many changes on GCD(Grand Central Dispatch).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With