     }
     
     func image(image : UIImage, didFinishSavingWithError error : NSError!, contextInfo : UnsafePointer<Void>) {
-        
         if error != nil {
-            
             var alertController : UIAlertController?
             
             if error.code == ALAssetsLibraryAccessUserDeniedError || error.code == ALAssetsLibraryAccessGloballyDeniedError {

    @IBAction func handleRotation(gr : UIRotationGestureRecognizer) {
        if gr.state == .Began {
            gr.rotation = self.gradientView.rotation;
        }
        else if gr.state == .Changed {
            self.gradientView.rotation = gr.rotation
        }
    }
    
    @IBAction func handleTap(gr : UITapGestureRecognizer) {
        if (self.saveIndicator.superview != nil) {
            self.hideSaveIndicator()
        } else {
            self.saveGradient()
        }
    }
    
    func saveGradient () {
        UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, true, 0.0)
        self.view.drawViewHierarchyInRect(self.view.bounds, afterScreenUpdates: false)
        let screenshot = UIGraphicsGetImageFromCurrentImageContext()

            }
            
            alertController?.addAction(UIAlertAction(title: NSLocalizedString("close", comment: ""), style: .Cancel, handler: nil))
            self.presentViewController(alertController, animated: true, completion: { () -> Void in
                self.saveState = .Idle
            })
            
        } else {
            self.saveState = .Saved
            self.showSaveIndicator()
        }
    }
    
