      It recommended to add validatots consequently respecting the order of a fields in the form.
      */
     public func add(validator: Validator) {
+        self.add(validator: validator) { () -> Bool in
+            return true
+        }
+    }
+    
+    
+    /**
+     Adds a new conditional validator to a validation list
+     
+     - Parameter validator: A validator to be added to the validation list
+     - Parameter condition: A condition when the validator must be executed
+     
+     The order of added validators matters. The first added validators will be executed first.
+     If a validator of a control fails, the other validators of the control will not be executed.
+     It recommended to add validatots consequently respecting the order of a fields in the form.
+     If condition returns `false` the validator will mark the field as valid.
+     */
+    public func add(validator: Validator, condition: @escaping ValidatorCondition) {
         validators.append(validator)
+        validatorConditions.append(condition)
     }
     
     


import UIKit

/// Adds to `UIViewController` validation functionality
open class ValidatorViewController: UIViewController {
    // MARK - VALIDATION
    private var validators = [Validator]()
    
    
    
    /**
     Adds a new validator to a validation list
     
     - Parameter validator: A validator to be added to the validation list
     

        var inValidatedControls = Set<UIView>()
        self.firstFailedControl = nil
        
        for (index, validator) in validators.enumerated() {
            var isControlValid = false
            
            // all controls should be UIViews so there shouldn't be any problem
