Mobile App/iOS

Swift - 4 image 불러오기, url image 불러오기

bugtype 2019. 3. 9. 15:09

Swift - 4 image 불러오기, url image 불러오기

image 불러오기 UIImage


var uiImageView = UIImageView()
var image: UIImage = UIImage(named: "sdk")!
uiImageView = UIImageView(image: image)
uiImageView

image url로 불러오기 UIImage

let url = URL(string: "http://verona-api.municipiumstaging.it/system/images/image/image/22/app_1920_1280_4.jpg")
let data = try Data(contentsOf: url!)
uiImageView.image = UIImage(data: data)
uiImageView