Example #1
0
        public override bool ValidateProperty(TKEntityProperty property)
        {
            emptyField      = false;
            incorrectFormat = false;
            NSString email = (NSString)property.ValueCandidate;

            if (email == null || email.Length == 0)
            {
                emptyField = true;
                return(false);
            }

            string      emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
            NSPredicate predicate  = NSPredicate.FromFormat("SELF MATCHES %@", (NSString)emailRegex);

            incorrectFormat = !predicate.EvaluateWithObject(email);
            if (incorrectFormat)
            {
                return(false);
            }

            return(true);
        }