For this assessment, you will be creating a multi-view application with three layers of views, designed to display and modify data stored in a plist file. The application will allow users to navigate through states, their corresponding zip codes, and modify zip codes.
-
First/Main View:
- Displays a list of all states from the plist.
- Allows users to select a state and navigate to the second view to see its zip codes.
-
Second View:
- Displays a list of zip codes for the selected state.
- Allows users to select a zip code and navigate to the third view to modify it.
-
Third View:
- Shows the selected zip code and includes a text field for modification.
- Saves the modified zip code and updates the zip codes list in the second view.
The project contains the following components:
-
Model:
State
: Represents a state with its name and associated zip codes.ZipCode
: Represents a zip code.DataManager
: Manages reading and writing data from/to the plist.
-
Views:
MainViewController
: Displays the list of states.ZipCodesViewController
: Displays the list of zip codes for the selected state.ModifyZipCodeViewController
: Allows modifying the selected zip code.
-
Plist:
- Contains the data for states and their zip codes.
- Load the list of states from the plist file.
- Populate a table view with the states.
- When a state is selected, navigate to the second view, passing the selected state.
- Load the zip codes for the selected state.
- Populate a table view with the zip codes.
- When a zip code is selected, navigate to the third view, passing the selected zip code.
- Display the selected zip code in a text field.
- Allow the user to modify the zip code.
- Save the modified zip code back to the plist.
- Ensure the updated zip code is reflected in the second view's table view.
- Use delegation or closure callbacks to pass data between views.
- Ensure that changes are saved to the plist file and reloaded appropriately.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>States</key>
<array>
<dict>
<key>Name</key>
<string>California</string>
<key>ZipCodes</key>
<array>
<string>90001</string>
<string>90002</string>
</array>
</dict>
<dict>
<key>Name</key>
<string>New York</string>
<key>ZipCodes</key>
<array>
<string>10001</string>
<string>10002</string>
</array>
</dict>
<!-- Add more states and zip codes as needed -->
</array>
</dict>
</plist>
- Ensure your code is well-commented and follows best practices for readability and maintainability.
- Handle edge cases such as empty zip codes or invalid inputs gracefully.
- Provide a simple and intuitive user interface.
This assessment requires you to create a well-structured, multi-view application that demonstrates your ability to manage data, navigate between views, and update persistent storage. Good luck!