Easy and lightweight library for Pesel (Polish National Identification Number) validation.
You can add framework to your project manually, or ...
add framework using Carthage:
github "lukszar/PeselSwift"
Below look at examples you can use in your app.
let pesel = Pesel(pesel: "XXXXXXXXXXX")
let result = pesel.validate()
switch result {
case .success:
print("success")
case .error(let error):
print("failure with error: \(error)")
}
or
let result = Pesel.validate(pesel: "XXXXXXXXXXX")
switch result {
case .success:
print("success")
case .error(let error):
print("failure with error: \(error)")
}
let pesel = Pesel(pesel: "XXXXXXXXXXX")
let date = pesel.birthdate()
print(date)
Download demo app to see examples of usage.