I expanded on another simple app that just added two values from text boxes. I used this app to practice formating doubles to the standard 2 decimal places. To do this in swift, do the following:
- Multiply your value by 100 (for the 2nd place unit)
- Round that value.
- Divide the roudned value by 100.
- Profit.
Example:
Double((round(12.12432 * 100) / 100))
The app returns the individual fields for sales tax, tip and total meal cost as individual labels. This was a nicer improvement than my one label for everything.