AlamofireImageで簡単に画像の読み込み
AlamofireImageとは
AlamofireImage is an image component library for Alamofire.
1.CocoaPods
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '10.0' use_frameworks! target '<Your Target Name>' do pod 'AlamofireImage', '~> 3.3' end
2.Pod install
$ pod install
3.Usage
import AlamofireImage
UIImageView.af_setImage(withURL: URL(url))
urlがString型の場合は
UIImageView.af_setImage(withURL: URL(string: url))