     }
     
     func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
-        let text = (textField.text! as NSString).stringByReplacingCharactersInRange(range, withString: string)
+        let text = textField.text == nil ? "" : (textField.text! as NSString).stringByReplacingCharactersInRange(range, withString: string)
         self.isValid(text)
         return true
     }

//  G8MKTextField.swift
//  G8MaterialKitTextField
//
//  Created by Daniele on 10/09/15.
//  Copyright (c) 2015 Daniele Galiotto. All rights reserved.
//


        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.delegate = self
    }
