Drivers licenses in the USA/Canada are all over the map and there are some suggestions that states follow but not all of them. How do you handle these differences? You could write and maintain this on your own or use an API that can parse the data from the bar code. If you want to do the former then feel free to copy this code, it is offered as is. If you want to use an API you can see the below documentation on how to do that.
For more information about formatting, data, questions, etc visit the wiki
Credit to @ksoftllc and his Swift library that I used to copy some of the parts that I did not have examples for - https://github.com/ksoftllc/license-parser
Driving license icons created by Freepik - Flaticon
If you want to support my work click here: Sponsor joshuaquiz