Add async method.

This commit is contained in:
Brent Simmons 2024-04-10 22:18:06 -07:00
parent 5c1caae42c
commit d7b3d15a2c

View File

@ -91,6 +91,14 @@ public extension RSImage {
#endif #endif
} }
static func image(with data: Data) async -> RSImage? {
let task = Task.detached { () -> RSImage? in
RSImage(data: data)
}
return await task.value
}
/// Asynchronously initializes an image from data. /// Asynchronously initializes an image from data.
/// ///
/// - Parameters: /// - Parameters: