A simple SwiftUI calculator app that performs basic arithmetic operations, logs session data to a Go server and SQLite database, and stores sessions locally on the iOS device using Core Data.
Here are some screenshots showcasing the app's features:
- macOS
- Xcode 16.2
- iOS 17.0+
- Go 1.21+
- Install Go (1.21+):
brew install go(macOS) - Navigate to
cd Backend - Run
go mod tidyto install dependencies. - Run
go run *.goto start the server onhttp://localhost:3000
- Open
Calculator.xcodeprojin Xcode. - Under
Signing & Capabilitieschange the Team value to your development team. - Build and run on the iOS simulator. (Cannot be run on a real device because of the server local ip address. In a production scenario, the server would be publically accessible. In a dev environment, the server would be internally accessible.)
- Perform a calculation or two.
- Once you swipe the app so that it goes into the background, you will see a message in the Xcode debug console, in the terminal where you started the backend server, and the backend SQLite
Calculator.dbwill be updated. - You can view past sessions by selecting the
View Session Datain the app; it will show the current session and the previous sessions in descending order by last updated date.
Table: sessions
| Column | Data Type | Attributes | Description |
|---|---|---|---|
| session_id | TEXT | PRIMARY KEY | Unique identifier for each session |
| add_count | INTEGER | DEFAULT 0 | Number of addition operations performed |
| subtract_count | INTEGER | DEFAULT 0 | Number of subtraction operations performed |
| multiply_count | INTEGER | DEFAULT 0 | Number of multiplication operations performed |
| divide_count | INTEGER | DEFAULT 0 | Number of division operations performed |
| last_updated | DATETIME | DEFAULT CURRENT_TIMESTAMP | Timestamp of the last update |
Request Body:
{
"sessionId": "string",
"addCount": integer,
"subtractCount": integer,
"multiplyCount": integer,
"divideCount": integer,
"lastUpdated": "string" // ISO 8601 format, e.g., "2025-02-27T12:00:00Z"
}Sample Data
{
"sessionId": "550e8400-e29b-41d4-a716-446655440000",
"addCount": 3,
"subtractCount": 1,
"multiplyCount": 2,
"divideCount": 0,
"lastUpdated": "2025-02-26T10:00:00Z"
}- Written in Swift
- iOS
- SwiftUI
- MVVM Architecture
- SwiftLint
- Persists data locally via Core Data and sends each session’s data to the backend once the app is about to go into the background.
- Creates a new session each time the app launches.
- Written in Go
- Uses the Gin web framework for HTTP routing.
- Stores data in an SQLite database located at Backend/calculator.db.
- Implements basic authentication with hardcoded credentials (only done for this sample project, not something that would be done in development or production environments), though not currently applied to routes.
- Provides two endpoints:
- POST /api/session: Saves session data to the database
- GET /api/sessions: Retrieves all stored sessions (this was for my testing purposes)
- Added unit tests and mocks for both the Swift frontend and Go backend.
- Used Async/Await to handle concurrency.
Proprietary Software
© 2025 SarahUniverse
This software and its source code are the exclusive property of SarahUniverse. No part of this software may be reproduced, distributed, or transmitted in any form or by any means without prior written permission.





