mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-10 17:02:54 +01:00
Fix concurrency warnings in Core module.
This commit is contained in:
parent
e03ad03e60
commit
71cd0fc20e
@ -93,24 +93,7 @@ public extension RSImage {
|
|||||||
|
|
||||||
static func image(with data: Data) async -> RSImage? {
|
static func image(with data: Data) async -> RSImage? {
|
||||||
|
|
||||||
let task = Task.detached { () -> RSImage? in
|
RSImage(data: data)
|
||||||
RSImage(data: data)
|
|
||||||
}
|
|
||||||
return await task.value
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Asynchronously initializes an image from data.
|
|
||||||
///
|
|
||||||
/// - Parameters:
|
|
||||||
/// - data: The data object containing the image data.
|
|
||||||
/// - imageResultBlock: The closure to call when the image has been initialized.
|
|
||||||
static func image(with data: Data, imageResultBlock: @escaping ImageResultBlock) {
|
|
||||||
DispatchQueue.global().async {
|
|
||||||
let image = RSImage(data: data)
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
imageResultBlock(image)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a scaled image from image data.
|
/// Create a scaled image from image data.
|
||||||
|
Loading…
Reference in New Issue
Block a user