Reputation: 54
I am trying to implement an on demand retry for a KFImage in SwiftUI. My KF image looks like this
KFImage(icon)
.attachPlaceholderAndErrorView(onError: { _ in
isFailed = true
})
.retry(RetryHandler(shouldRetry: $shouldRetry))
.resizable()
.aspectRatio(contentMode: .fit)
.isVisible(condition)
attachPlaceholderAndErrorView is a custom modifier that attaches a placeholder progressview, an on failure callback and an failure image. Basically I was expecting to pass a binding to a RetryHandler that is a struct conforming to RetryStrategy and fire the retry function every time I want... but this is not working as that. Does anyone have any ideea?
Upvotes: 0
Views: 341