//
//  UIImageView.swift
//  SwiftyPress
//
//  Created by Basem Emara on 4/1/16.
//
//

import UIKit
import Kingfisher

public extension UIImageView {

    /**
     Set an image with a URL and placeholder using caching.

     - parameter URL:         The URL of the image.
     - parameter placeholder: The palceholder image when retrieving the image at the URL.
     */
    public func setURL(_ url: String, placeholder: String? = "placeholder") {
        self.kf.setImage(with: URL(string: url)!,
            placeholder: placeholder != nil ? UIImage(named: placeholder!) : nil)
    }
    
}

//
//  UIImageView.swift
//  SwiftyPress
//
//  Created by Basem Emara on 4/1/16.
//
//

import UIKit
import Kingfisher

public extension UIImageView {

    /**
     Set an image with a URL and placeholder using caching.

     - parameter URL:         The URL of the image.
     - parameter placeholder: The palceholder image when retrieving the image at the URL.
     */
    public func setURL(_ url: String, placeholder: String? = "placeholder") {
        guard let url = URL(string: url) else {
            self.image = UIImage(named: placeholder!)
            return
        }
        
        self.kf.setImage(with: url, placeholder:
            placeholder != nil ? UIImage(named: placeholder!) : nil)
    }
    
}

Fix image extension when loading blank URL’s based on Swift 3 migration changes.
Fix image extension when loading blank URL’s based on Swift 3 migration changes.
