MihaelIsaev / UIKitPlus

🏰 Declarative UIKit with LivePreview for iOS9+ (best alternative to SwiftUI)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ImageLoader` should remove image for bad `url`

markst opened this issue · comments

When using a bad image url for a UImage :

UImage(url: $viewModel.map({ $0?.image }), loader: .defaultFade)

The existing image is kept, this is a problem when reusing a UImage.

Since ImageLoader does check the url is 'valid', perhaps it should reset the image before returning?
https://github.com/MihaelIsaev/UIKitPlus/blob/master/Classes/Objects/ImageLoader.swift#L44

Also wonder why a dispatch on the loaderQueue is queued from a .main dispatch?
https://github.com/MihaelIsaev/UIKitPlus/blob/master/Classes/Objects/ImageLoader.swift#L38

Why not simplify and simply dispatch on the loaderQueue.