ImageView.swift 614 B

1234567891011121314151617181920
  1. //
  2. // ImageView.swift
  3. // HCQuanfangtong
  4. //
  5. // Created by 崔毅 on 2022/7/16.
  6. // Copyright © 2022 Jyp. All rights reserved.
  7. //
  8. import Foundation
  9. extension UIImageView{
  10. func sd_setImage(url: URL?, placeHolderImage: UIImage? = nil, options: SDWebImageOptions = .retryFailed, completed: ((UIImage?)->Void)? = nil){
  11. self.sd_internalSetImage(with: url, placeholderImage: placeHolderImage, options: options, context: nil) { image, _, _, _ in
  12. self.image = image
  13. } progress: { _, _, _ in
  14. } completed: { image, _, _, _, _, _ in
  15. completed?(image)
  16. }
  17. }
  18. }