Parsing JSON using Codable to create a tab bar controller consisting of Users and Apple Stock Prices
- Fork this repository.
- Clone it to your machine
- Complete the sections below
- Add, commit and push your changes
- Create a pull request from your fork back to the original repo here
- Paste the link to your fork into Canvas
You are given two .json files. Create a Tab Bar Controller that manages two View Controllers, each one with a Table View inside. Selecting a row in a table view should segue to another View Controller with more information about the specific item selected.
JSON from the following projects is included in the project.
Create a class to hold the information from userinfo.json.
Use JSONDecoder().decode(<Decodable.protocol>, from: ) to convert the JSON with Codable
Your View Controller should contain:
- A table view
- A search bar
The table view should list each contact in alphabetical order. Each table view cell should contain the capitalized name of the contact and their location. Feel free to use a default TableViewCell (e.g you don't need to create you own subclass).
The search bar should filter all the contacts based on their full name.
Your detail View Controller should contain:
- A UIImage with the default profile image
- At least three labels to hold more information from the contact
You will need to use Auto Layout to constrain your views. Feel free to customize this page with additional information.
Create a class to hold the information from applstockinfo.json.
Use JSONDecoder().decode(<Decodable.protocol>, from: ) to convert the JSON with Codable
Your View Controller should contain:
- A table view
The table view should list each stock price in order from oldest to newest. Each table view cell should contain the date and the opening stock price. Feel free to use a default TableViewCell (e.g you don't need to create you own subclass).
The table view should also have sections. Every month and year should have its own section. The title for the section should display the month and year as well as the average for all stock opening prices that month.
Your detail View Controller should contain:
- A UIImage
- A label to represent the date
- Two labels to represent the opening and closing prices
If the stock price went up that day, set the background color to green and make the image a thumbs up.
If the stock price went down that day, set the background color to red and make the image a thumbs down.
You will need to use Auto Layout to constrain your views.
Criterion | Points |
---|---|
App uses Auto Layout | 4 |
Variable Naming and Readability | 4 |
Loads an array of Contact objects using Codable | 8 |
Loads an array of Contact objects using Codable | 8 |
Table views are populated | 4 |
Contacts search bar works as expected | 4 |
Sections load appropriately in Stock table view | 4 |
Detail views and segues behave appropriately | 4 |