import CountryPhoneNumberValidator
var phoneView: PhoneNumberView!
phoneView = PhoneNumberView(vc: self, button: verifyButton)
verifyButton.addTarget(self, action: #selector(verifyPhoneNumber), for: .touchUpInside)
func verifyPhoneNumber() {
phoneView.validate { (completed) in
if completed {
self.showAlert(withTitle: "Success", message: "PhoneNumber is Valid")
}else{
self.showAlert(withTitle: "", message: "The phone number is not valid.")
}
}
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
Copy CountryPhoneNumberValidator to your project folder
- Refactor PhoneNumberView for customization.
- Improve phone number validation.
- Make installing from cocoapod.
moderateepheezy, moderateepheezy@gmail.com
CountryPhoneNumberValidator is available under the MIT license. See the LICENSE file for more info.