Using the following code on my IBACTION to put my UIImageview > UIImage > PNG in photo
However, when I press my IBACTION, the image is not in my gallery
UIGraphicsBeginImageContextWithOptions(self.theView.bounds.size, view.isOpaque, 0)
theView.layer.render(in: UIGraphicsGetCurrentContext()!)
let theCapturedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let data = theCapturedImage!.pngData()
let url = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(NSUUID().uuidString+".dat")
do {
try data!.write(to: url!, options: [])
} catch let e as NSError {
print("Error! \(e)");
return