Skip to content

Kiran1510/Expense-Share

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

19 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฐ Expense Share

An expense tracking and splitting app for macOS, inspired by Splitwise, vibe-coded UI with core logic designed, tested and impelemented by me. Built with SwiftUI.

macOS Swift License


โœจ Features

๐Ÿ’ธ Flexible Expense Splitting

  • Equal Split - Divide expenses equally among participants
  • Custom Percentages - Specify exact percentages (e.g., 50/30/20)
  • Custom Amounts - Enter actual rupee amounts per person
  • Multi-payer Support - Multiple people can pay for one expense

๐Ÿ‘ฅ People Management

  • Add unlimited people to your roster
  • Edit names anytime
  • Delete protection for people in active groups
  • Quick-add people while creating groups
  • Full undo support (Cmd+Z)

๐Ÿ“Š Interactive Charts & Analytics

  • Pie Charts - Spending by category or person
  • Timeline Bar Chart - Expense history over time
  • Toggle Display - Switch between percentages and actual amounts
  • Real-time Updates - Charts update as you add expenses

๐ŸŽฏ Smart Group Management

  • Create multiple groups for different trips/projects
  • Select which members participate in each expense
  • Two debt settlement views:
    • Simplified - Minimal transactions (greedy algorithm)
    • Detailed - All cross-payments shown
  • Real-time net balance calculations

๐Ÿท๏ธ Category Tracking

  • Optional categorization (Food, Travel, Shopping, etc.)
  • Quick-pick buttons for frequently used categories
  • Set categories via context menu
  • Filter expenses by category

๐Ÿ” Powerful Search & Filtering

  • Search by description or category
  • Filter by person (payer or participant)
  • Sort by date, amount, or description
  • Multiple sort options (ascending/descending)

๐Ÿ“ค Export Capabilities

  • Group CSV - Export all group expenses
  • Person CSV - Export individual expense history
  • Auto-opens in Finder after export
  • Proper CSV formatting with escaping

โช Full Undo/Redo Support

  • Cmd+Z to undo any action
  • Cmd+Shift+Z to redo
  • Integrates with macOS Edit menu
  • User-friendly action names
  • Undo for: add, edit, delete expenses, category changes, toggle settings

๐Ÿ’พ Persistent Storage

  • Automatic JSON persistence
  • Saves to Application Support directory
  • Data survives app restarts
  • Backward compatible with old data

๐Ÿ–ฅ๏ธ Screenshots

Main Interface

Group overview with statistics, interactive charts, and expense list

Interactive Charts

Pie charts showing spending breakdown by category/person with toggle for percentages/amounts

Custom Split Options

Three split types: Equal, Custom Percentages, and Custom Amounts

People Management

Add, edit, and delete people with usage tracking


๐Ÿš€ Getting Started

Requirements

  • macOS 13.0 or later
  • Xcode 15.0 or later
  • Swift 5.9 or later

Installation

  1. Clone the repository

    git clone https://github.com/Kiran1510/Expense-Share.git
    cd Expense-Share
  2. Open in Xcode

    open "Expense Share.xcodeproj"
  3. Build and Run

    • Press Cmd+R or click the Run button
    • The app will launch with demo data

First Launch

The app automatically creates demo data on first launch:

  • People: Kiran, Arun, Meera
  • Group: Demo Group
  • Expense: Pizza (โ‚น900)

You can delete these and add your own data via "Manage People" and "New Group".


๐Ÿ“– How to Use

1. Managing People

  1. Click "Manage People" in the sidebar
  2. Add people you share expenses with
  3. Edit names by right-clicking
  4. Delete unused people (protected if in groups)

2. Creating Groups

  1. Click "New Group" in sidebar
  2. Enter group name (e.g., "Goa Trip")
  3. Select members from your people list
  4. Or quick-add new people on the fly
  5. Click "Create group"

3. Adding Expenses

  1. Select a group from the sidebar
  2. Scroll to "Add a new expense"
  3. Enter description (e.g., "Dinner")
  4. Optional: Add category
  5. Enter amounts each person paid
  6. Select who participated
  7. Choose split type:
    • Equal - Split evenly
    • Custom % - Enter percentages (must total 100%)
    • Custom โ‚น - Enter exact amounts
  8. Click "Add expense"

4. Viewing Balances

  • Overview section shows who paid what
  • Net position shows who owes/receives money
  • Toggle "Simplify debts" for minimal payments
  • Charts show spending breakdown

5. Editing Expenses

  • Double-click any expense to edit
  • Or right-click โ†’ "Edit"
  • Change split type, amounts, participants
  • Press Cmd+Z to undo changes

6. Exporting Data

  • Click "Export group CSV" for all expenses
  • Or "Export member CSV" for individual history
  • Files open automatically in Finder
  • Location: ~/Documents/ExpenseShareExports/

๐Ÿ—๏ธ Project Structure

Expense_Share/
โ”œโ”€โ”€ Expense_ShareApp.swift          # App entry point
โ”œโ”€โ”€ Models & Store/
โ”‚   โ”œโ”€โ”€ ExpenseStore.swift          # Core data models and business logic
โ”‚   โ””โ”€โ”€ ExpenseStore+Undo.swift     # Undo/redo support
โ”œโ”€โ”€ Views/
โ”‚   โ”œโ”€โ”€ ContentView.swift           # Main UI (sidebar + detail)
โ”‚   โ”œโ”€โ”€ EditExpenseSheet.swift      # Edit expense modal
โ”‚   โ”œโ”€โ”€ ExpenseFilters.swift        # Search/filter/sort logic
โ”‚   โ”œโ”€โ”€ ChartsView.swift            # Interactive charts
โ”‚   โ””โ”€โ”€ PeopleManagementView.swift  # People CRUD interface
โ”œโ”€โ”€ Components/
โ”‚   โ””โ”€โ”€ CategoryPicker.swift        # Reusable category selector
โ””โ”€โ”€ Utilities/
    โ””โ”€โ”€ CSVExporter.swift           # CSV formatting and export

๐Ÿ”ง Technical Details

Data Models

Person

  • UUID identifier
  • Name

Group

  • UUID identifier
  • Name
  • Member IDs (references to People)
  • Simplify debts toggle
  • Creation date

Expense

  • UUID identifier
  • Group ID
  • Description
  • Optional category
  • Payer contributions (multi-payer support)
  • Participant IDs
  • Split type (equal/custom percentages/custom amounts)
  • Custom split values
  • Creation date

Core Algorithms

Cent-Based Arithmetic All calculations use integer cents to avoid floating-point rounding errors:

func toCents(_ amount: Double) -> Int
func fromCents(_ cents: Int) -> Double

Equal Split with Remainder Distribution Divides total evenly and distributes remainder cents to first N participants:

func sharesForParticipants(totalCents: Int, participantIDs: [UUID]) -> [UUID: Int]

Custom Percentage Split Allocates cents proportionally, last person gets remainder to prevent rounding errors:

func sharesForCustomSplit(totalCents: Int, customSplits: [UUID: Double], participantIDs: [UUID]) -> [UUID: Int]

Custom Amount Split Direct allocation of specified amounts:

func sharesForCustomAmounts(customSplits: [UUID: Double], participantIDs: [UUID]) -> [UUID: Int]

Simplified Debts (Greedy Settlement) Minimizes number of transactions:

  1. Calculate net balance for each person
  2. Match largest creditor with largest debtor
  3. Settle maximum possible amount
  4. Repeat until all balanced

Architecture

  • MVVM Pattern - ExpenseStore as ViewModel
  • SwiftUI - Declarative UI
  • Combine - Reactive data binding via @Published
  • JSON Persistence - Automatic save/load
  • NSUndoManager - Native undo/redo support

โŒจ๏ธ Keyboard Shortcuts

  • Cmd+Z - Undo last action
  • Cmd+Shift+Z - Redo
  • Cmd+W - Close window/sheet
  • Delete - Delete selected expense (swipe-to-delete)
  • Enter - Submit forms
  • Double-click - Edit expense

๐ŸŽจ Design Principles

User Experience

  • No Calculator Needed - Custom amounts eliminate mental math
  • Visual Feedback - Colors indicate who owes (red) and receives (green)
  • Progressive Disclosure - Advanced options appear when needed
  • Forgiving UI - Undo support for all major actions

Data Integrity

  • Cent-based calculations - Zero rounding errors
  • Validation - Can't add invalid data
  • Delete protection - Can't delete people in active groups
  • Automatic persistence - Never lose data

Performance

  • Efficient algorithms - O(n) for most operations
  • Lazy loading - Views update only when needed
  • Optimized SwiftUI - Minimal re-renders

๐Ÿ“Š Example Use Cases

1. Weekend Trip with Friends

Group: "Goa Trip"
Members: Alice, Bob, Charlie

Expense 1: Hotel โ‚น6,000 (Alice paid)
Split: Equal โ†’ Each owes โ‚น2,000

Expense 2: Dinner โ‚น900 (Bob paid)
Split: Alice 50%, Bob 30%, Charlie 20%
โ†’ Alice owes โ‚น450, Charlie owes โ‚น180

Result: Net balances calculated automatically

2. Shared Apartment

Group: "Apartment 402"
Members: Roommate A, Roommate B, Roommate C

Expense: Groceries โ‚น1,500 (Roommate A paid)
Split: Custom amounts
โ†’ A: โ‚น600, B: โ‚น500, C: โ‚น400 (based on what each person bought)

Track monthly expenses by category

3. Family Vacation

Group: "Kerala Trip"
Members: Dad, Mom, Kid1, Kid2

Expense: Activities โ‚น10,000
Split: Custom percentages
โ†’ Parents 70%, Kids 30% (fair split based on benefit)

๐Ÿ› ๏ธ Development

Building from Source

# Clone
git clone https://github.com/Kiran1510/Expense-Share.git
cd Expense-Share

# Open in Xcode
open "Expense Share.xcodeproj"

# Build
# Press Cmd+B or Product โ†’ Build

# Run
# Press Cmd+R or Product โ†’ Run

Data Location

  • App Data: ~/Library/Application Support/ExpenseShare/data.json
  • Exports: ~/Documents/ExpenseShareExports/

Clean Install

To reset all data:

rm -rf ~/Library/Application\ Support/ExpenseShare/

๐Ÿ”ฎ Future Roadmap

Planned Features

  • Multiple currencies with exchange rates
  • Receipt photo attachments
  • Recurring expenses
  • Budget tracking per category
  • Monthly/yearly spending reports
  • iCloud sync
  • iOS companion app
  • Dark/light mode themes
  • Custom color schemes per group
  • Import from CSV
  • Export to PDF with charts
  • Email summaries
  • Settlement reminders
  • Split by item (restaurant bills)

Technical Improvements

  • Unit tests (XCTest or Swift Testing)
  • UI tests
  • Performance profiling
  • Localization (i18n)
  • Accessibility improvements
  • Keyboard navigation
  • Drag-and-drop expense reordering

๐Ÿค Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Contribution Guidelines

  • Follow existing code style
  • Add comments for complex logic
  • Test your changes thoroughly
  • Update README if adding features

๐Ÿ› Known Issues

Current Limitations

  • No iCloud sync (local storage only)
  • Single currency (โ‚น Rupees)
  • Cannot merge/split groups
  • Cannot transfer expenses between groups
  • No data import from other apps

Reporting Bugs

Found a bug? Please open an issue with:

  • Description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • Screenshots if applicable

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

Inspiration

  • Splitwise - The gold standard for expense splitting
  • Apple SwiftUI - Modern declarative UI framework
  • Swift Charts - Native charting capabilities

Technologies Used

  • SwiftUI - UI framework
  • Swift Charts - Data visualization
  • Combine - Reactive programming
  • Foundation - Core utilities
  • AppKit - macOS integration (file operations)

๐Ÿ“ง Contact

Kiran Sairam - kiransairam1@gmail.com

Project Link: https://github.com/Kiran1510/Expense-Share


๐Ÿ“š Additional Resources

Learning Resources

Similar Projects


๐ŸŽฏ Quick Start Guide

For First-Time Users:

  1. Launch the app - Demo data loads automatically
  2. Click "Manage People" - Add your friends/family
  3. Click "New Group" - Create your first group (e.g., "Weekend Trip")
  4. Add expenses - Enter who paid and how to split
  5. View balances - See who owes whom
  6. Export - Save history as CSV

Pro Tips:

๐Ÿ’ก Use custom amounts when you know exact splits (saves mental math)
๐Ÿ’ก Enable "Simplify debts" to minimize number of payments
๐Ÿ’ก Add categories to track spending patterns
๐Ÿ’ก Use Cmd+Z liberally - everything is undoable!
๐Ÿ’ก Export regularly to backup your data
๐Ÿ’ก Double-click to quickly edit expenses
๐Ÿ’ก Toggle charts between percentages/amounts for different insights


๐Ÿ”ข Version History

v1.0.0 (Current)

  • โœ… Multi-payer expense support
  • โœ… Three split types (equal, custom %, custom amounts)
  • โœ… Interactive charts (pie, timeline)
  • โœ… People management
  • โœ… Full undo/redo support
  • โœ… Category tracking
  • โœ… Search, filter, sort
  • โœ… CSV export (group & individual)
  • โœ… Simplified debt calculations

๐Ÿ’ป System Requirements

  • macOS: 13.0 (Ventura) or later
  • Xcode: 15.0 or later (for development)
  • Disk Space: ~10 MB for app
  • Memory: ~50 MB RAM during use

๐Ÿ” Privacy

  • โœ… All data stored locally on your Mac
  • โœ… No cloud sync (no data leaves your device)
  • โœ… No analytics or tracking
  • โœ… No network requests
  • โœ… Open source (review the code yourself)

Your financial data stays 100% private and on your device.


โš–๏ธ License

MIT License

Copyright (c) 2025 Kiran Sairam

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


๐ŸŒŸ Star History

If you find this project useful, please consider giving it a โญ on GitHub!


Made with โค๏ธ using SwiftUI

About

A personal spending analytics app for MacOS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages