Skip to content

Commit

Permalink
Update Email and Password Validation (#19)
Browse files Browse the repository at this point in the history
- Update email validation documentation
- Add password validation documentation
  • Loading branch information
RedDragonJ authored Jan 18, 2023
1 parent ec116ad commit 0073e92
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import Foundation

public extension String {

/** Check if is a valid email address **/
/// Ensure is a valid email
/// - Returns: A boolean indicate if the email is real
func isValidEmail() -> Bool {
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"
let emailTestResult = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// File.swift
//
//
// Created by James Layton on 1/17/23.
//

import Foundation

public extension String {

/// Ensure is a valid password
/// Minimum 8 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet and 1 Number
/// - Returns: A boolean indicate if the password meet the requirements
func isValidPassword() -> Bool {
let pwRegEx = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{8,}$"
let pwResult = NSPredicate(format:"SELF MATCHES %@", pwRegEx)
return pwResult.evaluate(with: self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import UIKit
#endif

public enum BarButtonDirection {
case left
case right
}

public extension UIViewController {
func addCustomBarButton(imageName: String, direction: BarButtonDirection, action: Selector) {
let customImage = UIImage(named: imageName)
Expand Down

This file was deleted.

0 comments on commit 0073e92

Please sign in to comment.