3Calc App

Three independent calculators, each with a reusable history.

3Calc App

Keep the calculations separate

3Calc is an iOS app with three calculators in a swipeable interface. Each keeps its own expression, current input, and history. The idea came from a small frustration: doing several unrelated calculations in one place makes it easy to lose track of which result belongs to which question.

I designed and built the app independently in Swift and SwiftUI, from the data model and arithmetic to the interface, persistence, testing, and App Store release.


Download

Get 3Calc for iOS.



The app in use


History is part of the workspace

Each history entry stores the expression as well as the result. Tapping a result brings it into the current calculation; a long press offers copy and delete actions. A normal clear action resets the current expression, while clearing the history is a separate, confirmed action.

That separation lets a user start a new calculation without losing the context of earlier work. It also makes the three pages feel like distinct workspaces rather than three appearances of the same calculator. At dinner, for example, I can leave a tip calculation open on one page, split the bill on another, and swipe back to the numbers I already entered.


Arithmetic and state

I represented each calculator as a Codable model with an identifier, history, display value, expression, and a flag for a just-completed calculation. That last state helps determine whether the next input should continue from the result or begin something new.

The expression evaluator tokenizes numbers and operators, handles multiplication and division before addition and subtraction, and uses Decimal arithmetic. The interface is divided into calculator, keypad, and history components, while the parent view owns the three calculator states.

I save the collection as JSON in UserDefaults, preserving both unfinished calculations and history across launches. The history and the display therefore restore together, rather than relying on the view to reconstruct the calculation.


Demo

Switching calculators and working with independent histories.

What I learned

A calculator has a familiar layout, which makes deviations in behavior especially noticeable. This project made me pay closer attention to what happens after a result, after a correction, and after returning to an unfinished expression.

The app provides three separate calculation contexts. Making those contexts dependable required careful state modeling beneath the keypad.