This is a behavior tracker app tracking how many times in a week a user has made his own meal from groceries vs how many times the user buys cooked meal from outside and calculates how much money he/she saved based on some cost assumptions.
I designed the app with 4 views and 3 tabs: assumptions, tracker, progress. User can switch between each section with the tab bar controller at the bottom. In the first tab, user input cost of buying groceries and cost of buying meals and gets recorded into global variable. The second tab is a table view controller with a list of meals that user tracked. Tapping the add button on the top right enters the action view controller where user can input meal data to add to the table view cells. Meal data gets appended to the meals array. The third tab displays progress of money saving calculated from the meal assumptions and user input.
I follow the views I drew and developed my data model next to my views.
During this assignment, I learned how to use a TabViewController and connect multiple views, add UISlider to my Assumptions tab, add a UIDatePicker and UIPickerView, and import image from camera roll to collect user data from my ActionViewController and save to my TableViewController.
Challenge:
Since I had multiple parallel views, I had to figure out how to access the same data between views so I created some global variables.
I was able to save my tableViewController data into User Defaults so data stays there every time I relaunched the app however I couldn’t get the images to be saved.
My myDatabase.saved value (money saved on progress tab) was not updated when I update my cost assumptions in the assumptions tab after first time I set it.
Moving forward I would also like to add more variables like how many times user has eaten outside or eaten his own meal, and add features like deleting cells on the TableViewController.
My code on github: https://github.com/ada10086/Mobile-Lab/tree/master/Week%203%20Behavior%20Tracker/Behavior%20Tracker