Skip to content

Instantly share code, notes, and snippets.

@matdziu
Created February 27, 2019 09:16
Show Gist options
  • Select an option

  • Save matdziu/8e07f0ed877d7ce6707439af29f139fd to your computer and use it in GitHub Desktop.

Select an option

Save matdziu/8e07f0ed877d7ce6707439af29f139fd to your computer and use it in GitHub Desktop.
import Foundation
import UIKit
import Kingfisher
extension UIImageView {
func downloaded(from url: URL, placeHolder: UIImage?) {
self.kf.setImage(with: url,
placeholder: placeHolder,
options: [KingfisherOptionsInfoItem.cacheOriginalImage])
}
func cancel() {
self.kf.cancelDownloadTask()
}
func downloaded(from link: String, placeHolder: UIImage?) {
guard let url = URL(string: link) else { return }
downloaded(from: url, placeHolder: placeHolder)
}
func roundBorderCorners() {
self.layer.borderColor = UIColor(named: Color.grey.rawValue)?.cgColor
self.layer.borderWidth = 0.5
self.layer.cornerRadius = 3.0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment