Nutrition App Calculator Help

I am brand new to creating an app. My question is how to create code for a calculation. Are there tutorials on that.

For example, if a client can eat 100 grams of protein a day, 100 grams of carbs and 100 grams of fat, all in a day (these are macronutrients). I will create a tab that displays their calories and macros (pro/carbs/fats).
When they select a meal from one of my meals, can I get it to update the remainder macros? For example, meal they select has 25 gm of protein, 25 carbs and 25 fats. This will leave 75 grams in each category.

same with calories, if they can eat 1000 calories in a day, then they select meal 4 which is 250 calories, then the top tab will update to 750 calories left.

So, can I do formulas on an app based on the users selection. Is there a tutorial on that?

Any info would help.

@reconmatt

Welcome to the community.

If you were to subscribe to CWC+ the Recipe App in “iOS Foundations (SwiftUI)” Module 2 incorporates calculations as part of providing ingredient quantities to cater for the number of people to serve from the Recipe. That may give you a few pointers in how to deal with the calculations you want to do in your App idea.

thanks, i will check it out.