I try to display dynamic image.
image I receive in my json stream is "http / mySite.com / image.jpg"
So I created a var imageURL: UIImageView! in my class and I have a method that I fulfill my scrollview, in this method I this piece of code that does not work and I do not know what I've forgotten:Here the error of this line: URLWithString 'is unavailable: use object building' NSURL (string :)'
var imageURL: NSURL = NSURL.URLWithString(picture)
Here is the full code
self.imageURL = UIImageView()
self.imageURL.frame.origin.y = 50
var picture = subJson["pagemap"]["cse_thumbnail"][0]["src"].stringValue
var imageURL: NSURL = NSURL.URLWithString(picture)
var imageData: NSData = NSData(contentsOfURL: imageURL)!
var image: UIImage = UIImage(data: imageData)!
self.imageURL.image = UIImage(image)
thanks
Do what the error tells you to do.
Instead of: var imageURL = NSURL.URLWithSting(picture)
do: var imageURL = NSURL(string: picture)