     // Store any colours we've gotten before. Colours don't change.
     private static var hexColorCache = [String : UIColor]()
     
-    private class func getColorFromCache(hexString: String) -> UIColor? {
+    private class func getColorFromCache(_ hexString: String) -> UIColor? {
         guard let color = UIColor.hexColorCache[hexString] else {
             return nil
         }


import UIKit

// An extension to UIColor which adds a class function that returns a UIColor from the provided hex string. The colours are cached.

extension UIColor {
    
    // Convert a hex string to a UIColor object.
    class func colorFromHex(_ hexString:String) -> UIColor {
        
        func cleanHexString(_ hexString: String) -> String {
            
            var cleanedHexString = String()
            
            // Remove the leading "#"
            if(hexString[hexString.startIndex] == "#") {
                cleanedHexString = hexString.substring(from: hexString.index(hexString.startIndex, offsetBy: 1))
            }
            
            // TODO: Other cleanup. Allow for a "short" hex string, i.e., "#fff"
