From here, I decided to work on a few different things,
First the new app icon (don’t have a proper name yet):
Next, I’ve been working on the ability to add custom drink types.
My current system uses variables in the Constants file to get the right drink type and color. However, this system doesn’t work for custom drink types and colors.
My first thought on this, was to have drink types and colors stored in the model, as none of the colors and custom drink types would save otherwise. I created an array with the drink types and copy-and-pasted the dictionary that I had in the Constants file.
However, this is a problem with this. My models have to be Encodable and Decodable, which is a protocol that Color and UIColor, don’t conform to.
I had to make a new struct, called CodableColor that stores a UIColor that can be encoded and decoded. I gave it a function that converts the stored UIColor into a Color, to make things a little easier.
Settings have a new page for Drink Types now. The default colors (Water, Coffee, Soda, and Juice), now have an option to change their colors using a ColorPicker, which is reflected across the rest of the app.
I also had to go through the app and have the app pull color and drink types from the model instead of Constants. That being said, the key for water in Constants is still used, primarily in HealthKit functionality.
Here are what these screens look like:
As you can see, I still need to add the ability to add custom drink types. Much of the groundwork for this functionality is there, however.