 import ImageIO
 
 extension UIImage {
-
-    public class func animatedImageWithData(data: NSData) -> UIImage? {
-        guard let source = CGImageSourceCreateWithData(data, nil) else { return nil }
-
+    
+    class func gifWithData(data: NSData) -> UIImage? {
+        guard let source = CGImageSourceCreateWithData(data, nil) else {
+            print("SwiftGif: Source for the image does not exist")
+            return nil
+        }
         return UIImage.animatedImageWithSource(source)
     }
-
-    class func delayForImageAtIndex(index: Int, source: CGImageSource!)
-        -> Double {
+    
+    class func gifWithName(name: String) -> UIImage? {
+        guard let bundleURL = NSBundle.mainBundle().URLForResource(name, withExtension: "gif") else {
+            print("SwiftGif: This image named \"\(name)\" does not exist")
+            return nil
+        }
+        guard let imageData = NSData(contentsOfURL: bundleURL) else {
+            print("SwiftGif: Cannot turn image named \"\(name)\" into NSData")
+            return nil
+        }
+        return gifWithData(imageData)
+    }
+    
+    class func delayForImageAtIndex(index: Int, source: CGImageSource!) -> Double {
         var delay = 0.1
-
+        
         // Get dictionaries
         let cfProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil)
         let gifProperties: CFDictionaryRef = unsafeBitCast(

                return 0
            }
        }

        // Swap for modulo
        if a < b {
            let c = a
            a = b
            b = c
        }

        // Get greatest common divisor
        var rest: Int
        while true {
            rest = a! % b!

            if rest == 0 {
                return b! // Found it
            } else {

            delayObject = unsafeBitCast(CFDictionaryGetValue(gifProperties,
                unsafeAddressOf(kCGImagePropertyGIFDelayTime)), AnyObject.self)
        }
        
        delay = delayObject as! Double
        
        if delay < 0.1 {
            delay = 0.1 // Make sure they're not too fast
        }
        
        return delay
    }
    
    class func gcdForPair(var a: Int?, var _ b: Int?) -> Int {
        // Check if one of them is nil
        if b == nil || a == nil {
