Skip to content

Instantly share code, notes, and snippets.

View popmedic's full-sized avatar

Popmedic popmedic

View GitHub Profile
@popmedic
popmedic / Extension.swift
Last active July 13, 2018 14:58
(Swift 4.x) An extension to UIImage to load from a remote URL and an extension to UIImageView to load its image using the UIImage extension.
import UIKit
extension UIImage {
/// will load an image from a remote URL
/// - parameter fromURL: url to load from
/// - parameter completionHandler: completion handler for when the image is done loading.
/// - parameter image: UIImage? that was retrieved, or nil on error
/// - parameter error: LocalizedError? that is nil on success, or an error message on failure.
/// example
/// ```