Last year I built a simple garden harvesting solution in Dynamics to track veggies with their harvests. This year I updated the solution to include a season table so you could track harvests by veggie year over year. The model driven app is pretty straight forward, has simple inheritance, and allows for quick creating of harvests from a veggie so that all you have to do is say the number of veggies you harvested, and everything else will be there by default. It also allows you to modify said count or harvest date if you weren't recording data the same day you actually harvested. The perk of Dynamics is it is quite easy to configure to data visualization. The downside is it requires the backend of an enterprise solution.

In addition to creating the solution in Dynamics, I wanted to build a mobile iOS app that could accommodate similar functionality, but wouldn't require an enterprise solution like Dynamics to roll out. Enter: SwiftUI. Currently I have in place a local and static data model. The content view shows the scrolling cards, the on boarding view shows each row in the array, and our detail view shows static data related to the vegetable.
In the Minimum Viable Product (MVP) the goal is for a user to be able to associate harvest data to an existing vegetable in the data set. Once that has been accomplished I plan to move on to allowing the user to create any number of vegetables and being able to create and track harvest data for any of them. From there we will get to visualizations and ideally an Apple Watch app to select a vegetable and quickly create a harvest record.


The steps above were good progress, but had to be rebuilt twice because the type of project needed different setup upon initial creation. Core Data in SwiftUI is now behind the data model as opposed to static and local arrays. We can view all of the veggies that have been created, create new records, ensure a name is populated when creating, and finally delete unwanted records. While the style has yet to be enhanced, we are closer to a functioning product at this point. I do have styles that support both light and dark mode, so those will function seamlessly.




After updating the data model to support adding vegetables I updated the row detail to look similar to the first project so that we had beautiful vegetable photos in line with each record rather than just plain boring looking text. This was great, I could add vegetables and the type would pull the appropriate image based on my small catalog (and quite the if/else statement). This is my public note to update that to a switch case when I feel like trying, if ever. So, the next step was creating the harvest detail view, row detail, and ultimately the interaction with the data model when adding a harvest from a vegetable. This is where it all goes haywire. I spent way too much time getting to the point where I wanted to leverage the Core Data model rather than anything else only to find out SwiftUI converts everything to a string when interacting with it. Everything. I took a week off from working on the app because that is the worst. The upside is I still have the first projects I started without the Core Data model. The downside is this project is almost dead to me. Almost.
