Swift Library for validation and generation of CPF and CNPJ numbers 🇧🇷.
- CPF validation
- CPF generation
- CNPJ validation
- CNPJ generation
- Accepts plain or masked number as input.
- CPF has information about the fiscal region and brazilian states associated.
- CNPJ shows if the number is from a company headquarters (0001 before the verification digits).
do {
let cpf = try CPF(number: "51135733961")
cpf.isValid() // true
} catch Parser.InputError.invalidFormat {
print("invalid CPF format")
}
let cpf = CPF.generate()