These are simple calculator apps designed for all web and mobile devices using a variety of app development tools. It's a showcase for how the same logic can apply to multiple development environments and how to write unit and UI tests on all these platforms.
There are two iOS apps to check out. Calculator-Storyboard uses storyboards to create the UI and Calculator-SwiftUI uses SwiftUI to create the UI. Both can be run using Xcode on a Mac.
- Storyboard: Open
Calculator-Storyboard.xcodeprojinside theCalculator-Storyboarddirectory. Unit tests are found in theCalculator-StoryboardTestsdirectory. UI tests are found in theCalculator-StoryboardUITestsdirectory. - SwiftUI: Open
Calculator-SwiftUI.xcodeprojinside theCalculator-SwiftUIdirectory. (Note: SwiftUI only works with iOS 13+ or Xcode 11+.) Unit tests are found in theCalculator-SwiftUITestsdirectory and leverage the View Inspector library to set up all the tests. UI tests are found in theCalculator-SwiftUIUITestsdirectory.
Like iOS, two Android apps were created. Calculator-View uses the View system to create the UI and Calculator-Compose uses Jetpack Compose to create the UI. Open each respective folder in Android Studio and run any of the necessary Gradle builds to run each app. (Note for Calculator-Compose, make sure you have Android Studio Arctic Fox or later installed.) Unit tests are found in the <project-name>/app/src/test/* directory. Instrumented (UI) tests are found in the <project-name>/app/src/androidTest/* directory.
Go to the Calculator-ReactNative directory and run the following commands:
npm install
npm start
This will open Expo's Metro Bundler which will allow you to run the app in the browser, iOS simulator, or Android emulator. To run on a real device, install the Expo Go app and scan the QR Code on the bundler page. Unit tests are found in calc-methods.test.ts and UI tests are found in Calculator.test.tsx.
In Android Studio, make sure the Flutter and Dart plugins are installed. Then open calculator_flutter. Follow the necessary steps to run the app on a web browser or on an iOS or Android device/simulator. Unit tests are found in calculator_unit_test.dart and widget (UI) tests are found in calculator_widget_test.dart, both in the calculator_flutter/test directory.
