I\'m using SDWebView image and i want to show an Activity Indicator as placeholder, while fetching the image from remote.
I tried Malek\'s answer here How to show an act
Same code as above in SWIFT 4:
let activityIndicator = UIActivityIndicatorView.init(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
activityIndicator.center = addImage.center
activityIndicator.hidesWhenStopped = true
addImage.sd_setImage(with: URL(string: feed.image), completed: { (image: UIImage?, error: Error?, cacheType: SDImageCacheType, imageURL: URL?) in
activityIndicator.removeFromSuperview()
})
addImage.addSubview(activityIndicator)
activityIndicator.startAnimating()