Day 38 Complete

2022-08-03 1 min read

Day 38 of the 100 Days of SwiftUI is now complete. This is part three of project 7, where the challenge and the test are completed.

The three challenges were:

  1. Using the locale of the users device to select the right currency,
  2. Changing the colour of the amount depending on the value,
  3. Splitting the list into a section for personal and a section for business.

For the last one, I originally tried making a seperate view that output a section with a name, which worked well, except for deleting and adding new items to the expenses list, that wouldn’t work. Instead of figuring out how to wire that all up properly (which would be good to know how to do by the way, but tonight is not the night to figure that out), I made a separate view of the ForEach and a boolean if using the array.contains() to check if the items array has a ‘Personal’ or ‘Business’ entry. Simple enough.