Nuke icon indicating copy to clipboard operation
Nuke copied to clipboard

Async/await for NukeExtensions

Open NikKovIos opened this issue 11 months ago • 1 comments

Is there any async/await API planned?

import Nuke
import NukeExtensions

extension UIImageView {
    enum ImageLoadingError: Error {
        case pathIsNil
        case badURL
    }

    func loadImage(path: String?) async throws {
        guard let path else {
            throw ImageLoadingError.pathIsNil
        }
        guard let url = URL(string: path) else {
            throw ImageLoadingError.badURL
        }
        NukeExtensions.loadImage(with: url, into: self) <- here
    }
}

NikKovIos avatar Jan 19 '25 19:01 NikKovIos

I haven't considered it, but it would be nice to add.

kean avatar Mar 01 '25 18:03 kean