ContentView - marleysudbury/swiftui-calculator GitHub Wiki
This file contains the single view of the app that the user directly accesses. This view is made up of the other views contained within the app.
This file contents can be broken down like so:
- The
ContentViewstructurebuttonSize: CGFloat = 75.0a constant property used to specify the size of the CalcButtonsspacing: CGFloat = 10.0a constant property used to specify the space between CalcButtons@EnvironmentObject var appData: DataStoreXDwhich is our global data storevar body: some Viewwhich is the ContentView screen itselfVStackwith the background colourbgCalcScreenwhich hasappData.valuepassed as a parameter, and horizontal padding.Keyboardwhich hasbuttonSizeandspacingpassed as parameters, which are class properties of this screen.
- The
DataStoreXDclass, which can be accessed from any view@Published var value: Stringstores the value on the screen@Published var decimal: Boolstores if the value has a decimal part@Published var cache: Stringstores a previous value@Published var ac: BoolAC button says 'AC' iftrue, 'C' iffalse@Published var active: Dictionary<String, Bool>for each operation button, is it active?init()initialises the object
- The preview structure
- An instance of
ContentView()
- An instance of