{"id":18537220,"url":"https://github.com/shuddha2021/swiftcalc","last_synced_at":"2026-05-18T04:31:45.470Z","repository":{"id":245000698,"uuid":"816961248","full_name":"shuddha2021/SwiftCalc","owner":"shuddha2021","description":"SwiftCalc - A modern and elegant calculator app for iOS, designed with SwiftUI for seamless user experience. Featuring basic arithmetic functions, clear display, and haptic feedback, SwiftCalc is your go-to tool for quick and accurate calculations.","archived":false,"fork":false,"pushed_at":"2024-06-18T18:38:23.000Z","size":984,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-26T03:42:00.974Z","etag":null,"topics":["arithmetic-operations","calculator-app","ios-development","mobile-app","percentage-calculations","programming","responsive-design","software-development","state-management","swift","swiftui","ui-design","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shuddha2021.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-18T18:24:12.000Z","updated_at":"2024-06-18T18:43:37.000Z","dependencies_parsed_at":"2024-06-18T23:55:01.447Z","dependency_job_id":"ebac4945-cd30-4190-80e7-99948bf22806","html_url":"https://github.com/shuddha2021/SwiftCalc","commit_stats":null,"previous_names":["shuddha2021/swiftcalc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuddha2021%2FSwiftCalc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuddha2021%2FSwiftCalc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuddha2021%2FSwiftCalc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuddha2021%2FSwiftCalc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shuddha2021","download_url":"https://codeload.github.com/shuddha2021/SwiftCalc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239255294,"owners_count":19608253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arithmetic-operations","calculator-app","ios-development","mobile-app","percentage-calculations","programming","responsive-design","software-development","state-management","swift","swiftui","ui-design","xcode"],"created_at":"2024-11-06T19:37:29.605Z","updated_at":"2025-10-06T22:18:18.687Z","avatar_url":"https://github.com/shuddha2021.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftCalc\n\nSwiftCalc is a modern and elegant calculator app built with SwiftUI. This app provides basic arithmetic operations in a clean, user-friendly interface, and includes features such as percentage calculations and sign inversion.\n\n## Features\n\n- **Basic Arithmetic Operations**: Perform addition, subtraction, multiplication, and division.\n- **Percentage Calculation**: Easily convert numbers to percentages.\n- **Sign Inversion**: Toggle the sign of numbers.\n- **Clear Function**: Quickly reset the calculator.\n- **Decimal Support**: Handle decimal numbers in calculations.\n- **User-friendly UI**: A clean and intuitive interface designed with SwiftUI.\n- **Responsive Design**: Optimized for both iPhone and iPad screens.\n\n## Technologies Used\n\n- **Swift**: The programming language used to build the app.\n- **SwiftUI**: A framework for building the user interface.\n\n## Core Logic\n\n### Button Actions\n\n- **AC**: Clears all inputs and resets the calculator.\n- **+/-**: Inverts the sign of the current input number.\n- **%**: Converts the current input number to a percentage.\n- **Arithmetic Operators (/ x - +)**: Sets the operation and prepares for the next input.\n- **=**: Calculates the result based on the current operation and inputs.\n- **Decimal Point**: Allows for decimal number input.\n- **Number Buttons**: Appends the pressed number to the current input.\n\n### Calculation Logic\n\n- **First Number Storage**: Stores the first number when an operation button is pressed.\n- **Second Number Storage**: Stores the second number when the equals button is pressed.\n- **Operation Handling**: Performs the arithmetic operation when the equals button is pressed and displays the result.\n\n## Screenshot\n\n\u003cimg width=\"1606\" alt=\"Screenshot 2024-06-18 at 1 35 13 PM\" src=\"https://github.com/shuddha2021/healthy-food-app/assets/81951239/41e1f8a2-56f2-47d1-bc8c-3201b477e570\"\u003e\n\n\u003cimg width=\"1633\" alt=\"Screenshot 2024-06-18 at 1 35 00 PM\" src=\"https://github.com/shuddha2021/healthy-food-app/assets/81951239/b685c0a6-4624-4997-96c2-ca557846f06e\"\u003e\n\n## Project Structure\n\n- `ContentView.swift`: The main SwiftUI view containing the user interface and logic.\n- `buttonPressed(_:)`: Handles the logic for each button press.\n- `calculateResult()`: Performs the calculation based on the current operation and inputs.\n- `buttonWidth(_:)` \u0026 `buttonHeight()`: Calculate the dimensions of the buttons for a responsive design.\n- `buttonColor(_:)`: Determines the color of each button based on its function.\n\n## Getting Started\n\n### Prerequisites\n\n- **Xcode**: Ensure you have Xcode installed on your Mac.\n\n### Installation\n\n1. Clone the repository.\n   ```bash\n   git clone https://github.com/yourusername/swiftcalc.git\n\n2. Open the project in Xcode\n   ```cd swiftcalc\n      cd swiftcalc\n      open SwiftCalc.xcodeproj\n\n### Running the Application\n\n1. Select the target device (iPhone or iPad) in Xcode.\n2. Click the Run button (or press Cmd+R) to build and run the app on the selected device or simulator.\n\n### Why This Project Is Useful\n\nThis project serves as a practical example of building a calculator app using SwiftUI, demonstrating the use of state management, UI design, and basic arithmetic operations in a mobile application. It provides a solid foundation for anyone looking to learn or improve their skills in iOS development with Swift and SwiftUI.\n\n### Contributing\n\nContributions to this project are welcome. Please fork the repository and create a pull request with your changes.\n\n### License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuddha2021%2Fswiftcalc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuddha2021%2Fswiftcalc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuddha2021%2Fswiftcalc/lists"}