|
@@ -82,7 +82,7 @@ extension KingfisherWrapper where Base: NSTextAttachment {
|
|
|
@discardableResult
|
|
@discardableResult
|
|
|
public func setImage(
|
|
public func setImage(
|
|
|
with source: Source?,
|
|
with source: Source?,
|
|
|
- attributedView: KFCrossPlatformView,
|
|
|
|
|
|
|
+ attributedView: @autoclosure @escaping () -> KFCrossPlatformView,
|
|
|
placeholder: KFCrossPlatformImage? = nil,
|
|
placeholder: KFCrossPlatformImage? = nil,
|
|
|
options: KingfisherOptionsInfo? = nil,
|
|
options: KingfisherOptionsInfo? = nil,
|
|
|
progressBlock: DownloadProgressBlock? = nil,
|
|
progressBlock: DownloadProgressBlock? = nil,
|
|
@@ -145,24 +145,26 @@ extension KingfisherWrapper where Base: NSTextAttachment {
|
|
|
@discardableResult
|
|
@discardableResult
|
|
|
public func setImage(
|
|
public func setImage(
|
|
|
with resource: Resource?,
|
|
with resource: Resource?,
|
|
|
- attributedView: KFCrossPlatformView,
|
|
|
|
|
|
|
+ attributedView: @autoclosure @escaping () -> KFCrossPlatformView,
|
|
|
placeholder: KFCrossPlatformImage? = nil,
|
|
placeholder: KFCrossPlatformImage? = nil,
|
|
|
options: KingfisherOptionsInfo? = nil,
|
|
options: KingfisherOptionsInfo? = nil,
|
|
|
progressBlock: DownloadProgressBlock? = nil,
|
|
progressBlock: DownloadProgressBlock? = nil,
|
|
|
completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?
|
|
completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?
|
|
|
{
|
|
{
|
|
|
|
|
+ let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))
|
|
|
return setImage(
|
|
return setImage(
|
|
|
with: resource.map { .network($0) },
|
|
with: resource.map { .network($0) },
|
|
|
attributedView: attributedView,
|
|
attributedView: attributedView,
|
|
|
placeholder: placeholder,
|
|
placeholder: placeholder,
|
|
|
- options: options,
|
|
|
|
|
|
|
+ parsedOptions: options,
|
|
|
progressBlock: progressBlock,
|
|
progressBlock: progressBlock,
|
|
|
- completionHandler: completionHandler)
|
|
|
|
|
|
|
+ completionHandler: completionHandler
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func setImage(
|
|
func setImage(
|
|
|
with source: Source?,
|
|
with source: Source?,
|
|
|
- attributedView: KFCrossPlatformView,
|
|
|
|
|
|
|
+ attributedView: @escaping () -> KFCrossPlatformView,
|
|
|
placeholder: KFCrossPlatformImage? = nil,
|
|
placeholder: KFCrossPlatformImage? = nil,
|
|
|
parsedOptions: KingfisherParsedOptionsInfo,
|
|
parsedOptions: KingfisherParsedOptionsInfo,
|
|
|
progressBlock: DownloadProgressBlock? = nil,
|
|
progressBlock: DownloadProgressBlock? = nil,
|
|
@@ -222,10 +224,11 @@ extension KingfisherWrapper where Base: NSTextAttachment {
|
|
|
switch result {
|
|
switch result {
|
|
|
case .success(let value):
|
|
case .success(let value):
|
|
|
self.base.image = value.image
|
|
self.base.image = value.image
|
|
|
|
|
+ let view = attributedView()
|
|
|
#if canImport(UIKit)
|
|
#if canImport(UIKit)
|
|
|
- attributedView.setNeedsDisplay()
|
|
|
|
|
|
|
+ view.setNeedsDisplay()
|
|
|
#else
|
|
#else
|
|
|
- attributedView.setNeedsDisplay(attributedView.bounds)
|
|
|
|
|
|
|
+ view.setNeedsDisplay(view.bounds)
|
|
|
#endif
|
|
#endif
|
|
|
case .failure:
|
|
case .failure:
|
|
|
if let image = options.onFailureImage {
|
|
if let image = options.onFailureImage {
|