         self.addSubview(textField)
         self.addSubview(label)
 
-        self.textField.backgroundColor = .red
+        self.textField.layer.shadowColor = UIColor.lightGray.cgColor
+        self.textField.layer.shadowOffset = CGSize(width: 0.0, height: 1.5)
+        self.textField.layer.shadowOpacity = 1.0
+        self.textField.backgroundColor = .white
+        self.textField.layer.cornerRadius = 5
+        self.layer.cornerRadius = 5
 
         let textFieldLeft: NSLayoutConstraint = NSLayoutConstraint(item: textField, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.left, multiplier: 1, constant: TextInputViewDimensions.margin)
         let textFieldRight: NSLayoutConstraint = NSLayoutConstraint(item: textField, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -TextInputViewDimensions.margin)
         let textFieldTop: NSLayoutConstraint = NSLayoutConstraint(item: textField, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.top, multiplier: 1, constant: TextInputViewDimensions.margin)
         self.textField.translatesAutoresizingMaskIntoConstraints = false
-        self.addConstraints([textFieldLeft, textFieldRight, textFieldTop])
+
+        let labelLeft: NSLayoutConstraint = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.left, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.left, multiplier: 1, constant: TextInputViewDimensions.margin)
+        let labelRight: NSLayoutConstraint = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: self, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -TextInputViewDimensions.margin)
+        let labelTop: NSLayoutConstraint = NSLayoutConstraint(item: label, attribute: NSLayoutAttribute.top, relatedBy: NSLayoutRelation.equal, toItem: textField, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: TextInputViewDimensions.offset)
+        self.label.translatesAutoresizingMaskIntoConstraints = false
+        self.addConstraints([textFieldLeft, textFieldRight, textFieldTop, labelLeft, labelRight, labelTop])
     }
 
     func checkText() {
         let text = self.textField.text ?? ""
         if let textChecker = self.textChecker {
             if textChecker.check(text: text) {
-                //configure for success
-                print ("ok")
+                successLayout()
             } else {
-                //configure for error
-                print ("nope")
+                errorLayout()
             }
         }
     }
 
     private func successLayout() {
+        self.textField.layer.shadowColor = UIColor.green.cgColor
 
     }
 
     private func errorLayout() {
+        self.textField.layer.shadowColor = UIColor.red.cgColor
 
     }
 

    static let offset: CGFloat = 8
}

class TextInputView: UIView, UITextFieldDelegate {
    private let textField = UITextField()
    private let label = UILabel()

    var textChecker: TextChecker?


//
//  Copyright © 2017 intive. All rights reserved.
//
import UIKit

protocol TextChecker {
    func check(text: String) -> Bool
}
