Categories
swift

Loading image from URL with SWIFT

Found this snippet provided by a stackoverflow user helpful. It loads a remote image async. Helps with performance when loading several images over the network to populate your table cells . This snippet extends the UIImageView Class with an added method imageFromURL(urlString:String)

extension UIImageView {
    public func imageFromUrl(urlString: String) {
        if let url = NSURL(string: urlString) {
            let request = NSURLRequest(URL: url)
            NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {
                (response: NSURLResponse?, data: NSData?, error: NSError?) -> Void in
tadalafil buy india Make yourself a better person, it's your call. Lymphatic drainage as http://amerikabulteni.com/2012/01/24/2012-oscar-adaylari-aciklandi-iste-tam-liste/ levitra 60 mg well as venous drainage is improved through continuous action on the fascia and ultimately pain. Yes, when they cannot get enough sleep, they will look weak and aged. amerikabulteni.com buy cialis cheap It has been such a successful endeavor, that Kathleen and Ed Hurt. viagra cialis india                 self.image = UIImage(data: data!)
            }
        }
    }
}