Skip to content

Instantly share code, notes, and snippets.

@omgbbqhaxx
Created October 27, 2016 18:02
Show Gist options
  • Select an option

  • Save omgbbqhaxx/ca0751ca0df91c42eb0243ce339b70ea to your computer and use it in GitHub Desktop.

Select an option

Save omgbbqhaxx/ca0751ca0df91c42eb0243ce339b70ea to your computer and use it in GitHub Desktop.
func getAssetThumbnail(asset: PHAsset) -> UIImage {
let manager = PHImageManager.default()
let option = PHImageRequestOptions()
var thumbnail = UIImage()
option.isSynchronous = true
manager.requestImage(for: asset, targetSize: CGSize(width: 100, height: 100), contentMode: .aspectFit, options: option, resultHandler: {(result, info)->Void in
thumbnail = result!
})
return thumbnail
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment