 import Dispatch
 
 public typealias TimePoint = CMTime
+public typealias ProgressCallback = ((CGImage, Double) -> Void)
 
 public class Regift: NSObject {
     struct Constants {

        return fileURL
    }
    
    public class func createGIFAsynchronouslyForTimePoints(timePoints: [TimePoint], fromURL URL: NSURL, fileProperties: [String: AnyObject], frameProperties: [String: AnyObject], frameCount: Int, progressHandler: ((CGImage, Double) -> Void)?, completionHandler: (NSURL? -> Void)?) -> Void {
        
        dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)) {
            let temporaryFile = NSTemporaryDirectory().stringByAppendingPathComponent(Constants.FileName)

                    println("Cancelling CGImage generation due to error: \(error)")
                    completionHandler?(nil)
                }
                else if result == .Succeeded {
                    CGImageDestinationAddImage(destination, image, frameProperties as CFDictionaryRef)
                    
                    generatedImageCount += 1.0
                    
                    let progress = Double(timePoints.count) / generatedImageCount
                    progressHandler?(image, progress)
                    
