This is a single class repo, intended to help with Spain DNI, CIF, NIT validation, was created because the lack of this in the internet, we search and results are almost 0, and in Swift well we can´t find any except this https://gist.github.com/gservera, this code is used as part of our integral solution, so we use as reference the code founded in this web page : http://www.lawebdelprogramador.com/codigo/JavaScript/1992-Validar-un-CIF-NIF-y-DNI.html, and here https://gist.github.com/gservera and we add some improvements.
You only need to add the SwiftDNICIFNITValidator.swift class to your project and use the static method called validateCIF this will return true if is valid or false if not
Almost all test numbers came from http://generadordni.es/
SwiftDNICIFNITValidator.validateCIF(cifCandidate: "F08216863") will return true SwiftDNICIFNITValidator.validateCIF(cifCandidate: " aaaa41d") will return false
Reinier Melian Massip email: [email protected]
Vladimir Sanchez Mondeja email: [email protected]