     public func getColors(scaleDownSize: CGSize = CGSize.zero) -> UIImageColors {
         
         var scaleDownSize = scaleDownSize
+        
         if scaleDownSize == CGSize.zero {
             let ratio = self.size.width/self.size.height
             let r_width: CGFloat = 250
-            scaleDownSize = CGSizeMake(r_width, r_width/ratio)
+            scaleDownSize = CGSize(width: r_width, height: r_width/ratio)
         }
         
         var result = UIImageColors()
         
-        let cgImage = self.resizeForUIImageColors(scaleDownSize).CGImage!
-        let width = CGImageGetWidth(cgImage)
-        let height = CGImageGetHeight(cgImage)
+        let cgImage = self.resizeForUIImageColors(newSize: scaleDownSize).cgImage!
+        let width = cgImage.width
+        let height = cgImage.height
         
         let bytesPerPixel: Int = 4
         let bytesPerRow: Int = width * bytesPerPixel
         let bitsPerComponent: Int = 8
         let randomColorsThreshold = Int(CGFloat(height)*0.01)
-        let sortedColorComparator: NSComparator = { (main, other) -> NSComparisonResult in
+        let sortedColorComparator: Comparator = { (main, other) -> ComparisonResult in
             let m = main as! PCCountedColor, o = other as! PCCountedColor
             if m.count < o.count {
-                return NSComparisonResult.OrderedDescending
+                return ComparisonResult.orderedDescending
             } else if m.count == o.count {
-                return NSComparisonResult.OrderedSame
+                return ComparisonResult.orderedSame
             } else {
-                return NSComparisonResult.OrderedAscending
+                return ComparisonResult.orderedAscending
             }
         }
         let blackColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)

        let findDarkTextColor = !result.backgroundColor.isDarkColor
        
        while var kolor = enumerator.nextObject() as? UIColor {
            kolor = kolor.colorWithMinimumSaturation(0.15)
            if kolor.isDarkColor == findDarkTextColor {
                let colorCount = imageColors.countForObject(kolor)
                sortedColors.addObject(PCCountedColor(color: kolor, count: colorCount))
            }
        }
        sortedColors.sortUsingComparator(sortedColorComparator)
        
        for curContainer in sortedColors {
            let kolor = (curContainer as! PCCountedColor).color
            
            if result.primaryColor == nil {
                if kolor.isContrastingColor(result.backgroundColor) {
                    result.primaryColor = kolor
                }
            } else if result.secondaryColor == nil {
                if !result.primaryColor.isDistinct(kolor) || !kolor.isContrastingColor(result.backgroundColor) {
                    continue
                }
                
                result.secondaryColor = kolor
            } else if result.detailColor == nil {
                if !result.secondaryColor.isDistinct(kolor) || !result.primaryColor.isDistinct(kolor) || !kolor.isContrastingColor(result.backgroundColor) {
                    continue
                }
                

        return false
    }
    
    func colorWithMinimumSaturation(minSaturation: CGFloat) -> UIColor {
        var hue: CGFloat = 0.0
        var saturation: CGFloat = 0.0
        var brightness: CGFloat = 0.0
