3Calc App
Multi-Calculator with Individual Histories
Overview
3Calc is my triple-calculator iOS app, letting users swipe between three distinct calculators, each with its own independent history stack. Instead of juggling multiple windows or losing track of older results, users can keep ongoing calculations neatly separated—perfect for switching between personal finance, a quick tip calculation, or a separate science formula.
I developed 3Calc entirely on my own:
- Design & UI/UX: all visuals, user flows, and layout decisions.
- SwiftUI Code: from data models to gesture handling and animations.
- Project Management: requirements planning, testing, release to the App Store, and promotional tasks.
Despite having numerous ways to unwind, I dedicate my free time to building iOS apps—3Calc is yet another result of my passion-driven coding and determination to expand my skill set.
Download
User Stories & Demo
Story 1: The Multi-Tasking Pro
“I often do separate calculations for personal budgeting, tip splits, and random math checks. I hate mixing them all in one cluttered history.”
3Calc solves this by giving you three distinct calculators. Swipe left or right to switch, and each retains its own history. No more confusion over which result belongs to which context.
Story 2: The “Recall & Reuse” Fan
“Sometimes I do a complex calculation, then realize I need that same result again—like a sub-total. It’d be great if I could just tap it from history.”
3Calc’s history log is fully interactive: tap an older result to reuse it in your new expression, or long-press to copy or delete it. Each line stores not just the result but also the preceding expression.
Watch 3Calc in Action
Project Highlights
1. Triple-Tab Calculator Design
- Swipe Between Three Calculators
Each calculator is a dedicated tab in aPageTabViewStyle. Flick left or right to move seamlessly among them. - Separate Histories
No cross-contamination. Each calculator’s result list remains independent, capturing the expression and final numeric outcome.
2. Detailed History & Reuse
- Scrollable History
The most recent results appear at the bottom; scroll upward to find older entries. - Long-Press on an Entry
- Copy both expression & result to your clipboard.
- Delete it from the log if it’s no longer needed.
- Tap to Reuse
Tapping an old result automatically inserts that value into your current calculation. Perfect for chaining multi-step calculations.
3. Handy Calculation Features
- Live Expression & Display
- The top of each calculator view shows the in-progress formula.
- The main result display updates as digits or operators are pressed, with standard operator precedence (*/ before +-).
- Undo & Clear
- A custom backspace button (
⌫) removes just the last digit. - A quick single-press of C resets the current calculator’s expression to zero, and a long-press can prompt to wipe the entire history.
- A custom backspace button (
4. Code Architecture & SwiftUI Patterns
- SwiftUI + Multi-File Structure
-
ContentView.swiftmanages the array ofCalculatorobjects, each of which has anid, ahistoryarray, and its owndisplay. -
CalculatorView.swift,CalculatorPadView.swift, andHistoryDisplay.swifthandle the layout, user input logic, and dynamic updates.
-
- Persistence with
UserDefaults- Each of the three calculators is saved as JSON. Closing the app preserves your partial calculations and entire history across launches.
- Responsive Animations & Gestures
- Leveraged
TabViewwith page-swiping gestures. - Built custom long-press actions in the history for copying or removing entries.
- Triggered haptic feedback on important actions (taps, long-presses) to enhance user engagement.
- Leveraged
Technical Breakdown
Data Modeling
Each calculator is represented by:
struct Calculator: Identifiable, Codable, Equatable {
let id: UUID
var history: [HistoryItem] = []
var display: String = "0"
var expression: String = ""
var justCalculated: Bool = false
}
-
historyholds an array ofHistoryItems, each storing the user’s expression and final result. -
displayis the current numeric input on screen. -
expressiontracks a partial formula if the user is chaining multiple operations.
Expression Parsing & Evaluation
- Tokenizing
- The user’s input is segmented into tokens (numbers, operators) to handle correct math precedence (× and ÷ before + and -).
- Decimal Arithmetic
- Everything is performed with
Decimal—rather thanDouble—to minimize floating-point rounding issues in a financial or high-precision scenario.
- Everything is performed with
Sample: Evaluate Expression
```swift func evaluateExpression(_ rawExpression: String) -> String { let tokens = rawExpression.components(separatedBy: " ") // Step 1: handle × and ÷ first // Step 2: handle + and - next // Return final decimal as a trimmed string or "Error" } ``` **Why it’s clever**: This two-pass approach is a straightforward way to respect standard operator precedence without diving into complicated expression trees.Layout & Gestures
-
TabView(selection:)- Each calculator is a subview, assigned an index in the array. Swiping horizontally cycles through them.
- History Scroll
- A
ScrollViewwith each entry in the history. Tapping re-injects that result into the current display, and a “long-press” menu allows copying or deletion.
- A
Local Persistence
-
UserDefaults.standard- The
[Calculator]array is saved ascalculators_v1. - On every update, the model is re-encoded to JSON.
- Ensures each calculator’s expression remains intact when the user reopens the app, with no external server required.
- The
Project Outcomes
-
Multi-Scenario Convenience
- Users can maintain separate contexts (work, personal, etc.) in parallel, never losing track of past results in a single jumbled history.
-
Seamless Reuse of Past Results
- Tapping old entries is a time-saver for multi-step calculations—no retyping of an older number needed.
-
Technical Scalability
- The SwiftUI architecture easily extends for potential new “specialty calculators”—like a scientific or unit-conversion tab—by adding more views or logic to each calculator instance.
Personal Growth & Reflection
Relentless Development Spirit
- While others might unwind with passive hobbies, I love pushing out new iOS projects. Building 3Calc was a testament to this unstoppable enthusiasm for coding.
Deepened SwiftUI & Arithmetic
- I refined custom numeric parsing, perfected concurrency in storing data, and orchestrated an intuitive UI flow for switching among multiple calculators.
Self-Driven Project Ownership
- From concept to deployment, I was the designer, developer, and QA. No external teams—just my passion, discipline, and a drive to deliver a polished product.
Final Thoughts
3Calc stands out as a time-saving, user-friendly tool for all sorts of calculations, organized into three distinct spaces. I wrote every line of code, designed each screen, and orchestrated the entire release—showcasing my ability to craft robust SwiftUI apps with clean code, thoughtful design, and real user benefits.
Now on the App Store, 3Calc highlights my dedication to building simple-yet-powerful iOS experiences. I’m excited to continue pushing the boundaries of my coding and design skills, and I believe this multi-calculator concept underscores my readiness for any App Developer role that demands creativity, technical expertise, and user-focused problem-solving.