WeSplit is a very basic iOS application used to split the bills among number of people. I build this application as the very first project as a part of 100DaysOfSwiftUI. As we know, the SwiftUI is the popular iOS framework right now to build high quality iOS applications which supports responsive layouts. Trying to learn SwiftUI by making these types of applications.
As i already mentioned that this project is very easy and basic which has following few requirements.
- The app should have only one screen with a form.
- Form should have input fields such as Amount, number of people, tip percentage, etc.
- The number of people and tip percentage should be picker and sould select from picker.
- The app should calculate the total amount from entered amount and the tip percentage. Show the total amount on the screen.
- The app should show the final result as the amount per person. That is, it should split the total amount among the number of people.
I started coding and building iOS applications using SwiftUI with this project. Got to learn following few points of SwiftUI while developing this project:
- Creating a form in SwiftUI: The SwiftUI has Form tag to create a form. We can add sections, input fields, and many more into the form.
- Navigation Bar: Adding a navigation bar in SwiftUi is quick different. Got to learn that since I have used it in this project.
- Program state and it's binding: As we provide input to the input fields of the form. The app should read/write that data in a variable and work accordingly.
- Pickers in Form: Learnt about the Pickers used in the Form and it's varients such as inline, segmented, wheel, etc.
- Computed properties in Struct: Used few computed properties through an app. It will calculate its value based on other variables which are binded to the input fields.
- ToolBar: Used toolbar to hide the button. Actually, created a new button in a system keyboard and handled keyboard's behavior though that newly added button.
Please refer the following screenshots and testing video to verify the behavior of an application.