     }
 
 }
+
+private extension UIView {
+    
+    var subviewTextField: UITextField? {
+        var textField: UITextField?
+        for subview in subviews {
+            if let possible = subview as? UITextField {
+                textField = possible
+            } else if let possible = subview.subviewTextField {
+                textField = possible
+            }
+            if textField != nil {
+                break
+            }
+        }
+        return textField
+    }
+    
+}

            addSubview(contentView)
            contentView.pinToSuperviewEdges()
            contentView.userInteractionEnabled = false
            innerTextField?.hidden = true
            if let attributes = innerTextField?.defaultTextAttributes {
                defaultTextAttributes = attributes
            }
            borderStyle = .None
        }
    }
    

    
    override func textRectForBounds(bounds: CGRect) -> CGRect {
        let rect = innerTextField?.frame ?? super.textRectForBounds(bounds)
        var rect: CGRect
        if let innerTextField = subviewTextField {
            rect = innerTextField.superview!.convertRect(innerTextField.frame, toView: self)
        } else {
            rect = super.textRectForBounds(bounds)
        }
        return rect
    }
    
    override func editingRectForBounds(bounds: CGRect) -> CGRect {
        return textRectForBounds(bounds)
    }
    
    // MARK: UIView
