Created
February 18, 2019 23:51
-
-
Save aChase55/8f0e9ccceb4a0718e399477276270861 to your computer and use it in GitHub Desktop.
Alamofire image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Alamofire | |
import AlamofireImage | |
extension UIImageView { | |
func loadImage(_ url:String?) { | |
guard let url = url else { return } | |
Alamofire.request(url).responseImage {[weak self] response in | |
guard let self = self else { return } | |
if let image = response.result.value { | |
self.image = image | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment