My first look at SwiftUI.
This is a simple app that calculates the amount an individual owes, given the bill amount, tip percentage and the number of people.
Used the following UI components:
- Form
- TextField
- Picker
- Button
- Alert
Got exposed to Modifiers, Property wrappers and other SwiftUI essentials. Used @State, @FocusState wrappers and experimented with them. @FocusState is used to toggle the placement of focus on a particular view. (Similar to firstResponder in UIKit by the looks of it). In this app, we used it to toggle the display of the keypad.
The $ symbol is used as a binding agent. It signifies that values can be read from and written into. Any change to properties marked with @State triggers the 'body' computed property and re-renders the UI.
Learning source: Hacking With Swift.