Five Function Calculator is a simple calculator app built using SwiftUI. It supports basic arithmetic operations, a clean interface, and responsive layout optimized for iPhone devices.
- Basic operations:
+,−,×,÷,% - Sign toggle:
+/- - Decimal input
- Clear (
AC) functionality - Clean, minimal design with dynamic layout
- Result formatting (e.g.,
3instead of3.0)
- Calculator buttons are defined using an
enum(CalcButton) for easy layout and styling. - The core calculation logic is handled inside the
didTap(button:)function. - Operations are represented via an
Operationenum and executed based on the current state. - UI is rendered using a grid-like structure of buttons via
ForEachloops. - Special formatting is added to display a clean value without unnecessary decimal points.
- Top display shows current input and active operation.
- Calculator buttons are styled and spaced consistently.
0button spans two columns for better UX.
- Xcode 14 or later
- iOS 15+
- Swift 5+
- Open
5FunCalc.xcodeprojin Xcode. - Select your target device or simulator.
- Press Cmd + R to build and run the app.
- Add scientific calculator functions (square root, power, etc.)
- Implement haptic feedback
- Add landscape support
- Save recent calculations
- Dark/light mode toggle
MIT License — feel free to use and modify!