Skip to content

Instantly share code, notes, and snippets.

@llinardos
Created August 1, 2017 03:16
Show Gist options
  • Save llinardos/6f56966dbb8cf070f0bf2b7380669f12 to your computer and use it in GitHub Desktop.
Save llinardos/6f56966dbb8cf070f0bf2b7380669f12 to your computer and use it in GitHub Desktop.
func showUserPhoto(for user: User, on imageView: UIImageView, placeholderImage: UIImage? = nil) {
if let photoImage = user.photoImage else {
imageView.image = photoImage
} else if let photoUrl = user.photoUrl else {
imageView.sd_setImageWithURL(photoUrl, placeholderImage:placeholderImage)
} else {
imageView.image = placeholderImage
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment