 //"blueColor": UIColor(hue: (211/360.0), saturation: 1.0, brightness: 1.0, alpha: 1),
 //"blueShadowColor": UIColor(hue: (216/360.0), saturation: 0.05, brightness: 0.43, alpha: 1),
 
+extension CGRect: Hashable {
+    public var hashValue: Int {
+        get {
+            return (origin.x.hashValue ^ origin.y.hashValue ^ size.width.hashValue ^ size.height.hashValue)
+        }
+    }
+}
+
+extension CGSize: Hashable {
+    public var hashValue: Int {
+        get {
+            return (width.hashValue ^ height.hashValue)
+        }
+    }
+}
+
 // handles the layout for the keyboard, including key spacing and arrangement
 class KeyboardLayout: NSObject, KeyboardKeyProtocol {
     

        self.solidColorMode = solidColorMode
    }
    
    func initialize() {
        assert(!self.initialized, "already initialized")
        
        self.createViews(self.model)
        
        self.initialized = true
    }
    

            self.superview.addSubview(keyView)
            
            self.keyPool.append(keyView)
            
            return keyView
        }
        
        if !self.sizeToKeyMap.isEmpty {
            var (size, keyArray) = self.sizeToKeyMap[self.sizeToKeyMap.startIndex]
            
            if let key = keyArray.last {
                if keyArray.count == 1 {
                    self.sizeToKeyMap.removeValueForKey(size)
                }
                else {
                    keyArray.removeLast()
                    self.sizeToKeyMap[size] = keyArray
                }
                
                return key
            }
            else {
                return createKey()
            }
        }
        else {
            return createKey()
        }
    }
    
    func resetKeyPool() {
        self.sizeToKeyMap.removeAll(keepCapacity: true)
        
        for key in self.keyPool {
            if var keyArray = self.sizeToKeyMap[key.frame.size] {
                keyArray.append(key)
                self.sizeToKeyMap[key.frame.size] = keyArray
            }
            else {
                var keyArray = [KeyboardKey]()
                keyArray.append(key)
                self.sizeToKeyMap[key.frame.size] = keyArray
            }
        }
    }
    
    //////////////////////
