Create image from base64 encoded string

Turn your base64 encoded string into an NSData instance by doing this:

let decodedData = NSData(base64EncodedString: base64String, options: NSDataBase64DecodingOptions.fromRaw(0)!)
var decodedimage = UIImage(data: decodedData)

Then turn the imageData into a UIImage:

let image = UIImage(data: imageData)

One reply on “Create image from base64 encoded string”