In Kingfisher documentation there is information about setting indicatorType when set image for regular imageView:
imageView.kf.indicatorType = .activity
imageView.kf.setImage(with: url)
But how to set indicatorType when set background image for UIButton?
myButton.kf.setBackgroundImage(with: url, for: .normal)
No direct way to do that
but you can do it like that create Custom UIButton
with indicator
like that
Display activity indicator inside UIButton
Then use like this
let btn = LoadingButton()
btn.showLoading()
btn.kf.setBackgroundImage(with: URL(string: ""), for: .normal) { (image, error, cachType, url) in
btn.hideLoading()
}