German license plates. There are over 700 different ones. Find them. Collect them. It's a game.
Starter Project KennDeinZeichen
Start with the following App 02 KennDeinZeichen Model Loading
The Sample Data only contains the minimum data. Check the JSON file contents (Inside Assets).
Modify either the Struct or the Import (Google on how to import custom JSON within Swift).
Add all missing elements.
Replace the old ...Sample with the new file.
Hints:
String?)Decodable protocol automatically maps JSON keys to struct properties with matching namesCodingKeys enumBuild a Struct that supports valid license plates
Requirements The LicensePlate shall be a Struct
The struct shall have a failable init method. (Failable inits are marked with init? and can return nil if validation fails. Use Xcode autocomplete for help.)
Create a computed variable that will return the LicensePlate like: HH MZ 4224E (See the spaces!)
Hints:
init?(district: String, letters: String, numbers: String, suffix: String?)guard statements to validate each component's lengthnil if any validation failsenum Suffix: String { case electric = "E", historic = "H" }formatted and use string interpolation: "\(district) \(letters) \(numbers)\(suffix ?? "")"