     
 }
 
-class StatusTextField: NibTextField {
+class StatusTextField: NibTextField, UITextFieldDelegate {
 
     // MARK: - Variables
 
     var status: ControlStatus = .None { didSet { setNeedsUpdateView() }}
+    
+    private var statusTextFieldNibView: StatusTextFieldNibView? {
+        return contentView as? StatusTextFieldNibView
+    }
+    
+    // MARK: - IBInspectable mapping to contentView Nib
+
+    @IBInspectable var message: String? {
+        get {
+            return statusTextFieldNibView?.messageLabel?.text
+        }
+        set {
+            statusTextFieldNibView?.messageLabel?.text = newValue
+        }
+    }
     
     // MARK: - IBInspectable mapping to variables
     

    var color: UIColor {
        switch self {
        case .None:
            return UIColor.blackColor()
        case .Success:
            return UIColor.greenColor()
        case .Warning:

            status = ControlStatus(rawValue: newValue) ?? .None
        }
    }

    // MARK: - Init

    override func commonInit() {
        super.commonInit()
        statusTextFieldNibView?.titleLabel?.text = nil
        message = nil
        status = .None
        super.delegate = self
    }
    
    // MARK: - updateView

    override func updateView() {
        super.updateView()
        statusTextFieldNibView?.iconView?.hidden = status == .None
        statusTextFieldNibView?.iconView?.tintColor = status.color
        statusTextFieldNibView?.borderView?.backgroundColor = status.color
        statusTextFieldNibView?.messageLabel?.textColor = status.color
    }

    // MARK: - UITextFieldDelegate
    
    private var externalDelegate: UITextFieldDelegate?
    
    override var delegate: UITextFieldDelegate? {
        get {
            return externalDelegate
        }
        set {
            externalDelegate = newValue
        }
    }
    
    func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
        var should = true
        if let externalShould = externalDelegate?.textFieldShouldBeginEditing?(textField) {
            should = externalShould
        }
        return should
    }

    func textFieldDidBeginEditing(textField: UITextField) {
        externalDelegate?.textFieldDidBeginEditing?(textField)
        statusTextFieldNibView?.titleLabel?.text = placeholder
        placeholder = nil // TODO: animate
    }

    func textFieldDidEndEditing(textField: UITextField) {
        externalDelegate?.textFieldDidEndEditing?(textField)
        placeholder = statusTextFieldNibView?.titleLabel?.text // TODO: animate
        statusTextFieldNibView?.titleLabel?.text = nil
    }
    
    func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
        var should = true
        if let externalShould = externalDelegate?.textField?(textField,
                                                             shouldChangeCharactersInRange: range,
                                                             replacementString: string)
        {
            should = externalShould
        }
        if should {

        }
        return should
    }
    
}
