Hi guys,
New to SwiftUI/coding in general, and was wondering if someone could help me.
Going through the 100 Days of SwiftUI, everything was fine with the Playground work, but I've encountered some problems with Project 1 and 2 with some of the code not building on my SwiftUI. For example the code below for Project 1 doesn't seem to work, and the error below it is given.
TextField("Amount", value: $checkAmount, format: .currency(code: Locale.current.currencyCode ?? "USD"))
Cannot infer contextual base in reference to member 'currency'.
Extra argument 'format' in call
Missing argument for parameter 'formatter' in call
Insert ', formatter: <#Formatter#>'
I managed to get around this (kind of) with 'NumberFormatter()', but I am now struggling with Project 2 as I can't do simple button styling such as:
VStack {
Button("Button 1") { }
.buttonStyle(.bordered)
Button("Button 2", role: .destructive) { }
.buttonStyle(.bordered)
Button("Button 3") { }
.buttonStyle(.borderedProminent)
Button("Button 4", role: .destructive) { }
.buttonStyle(.borderedProminent)
}
I am using a MacBook Pro 2012 and running Catalina 10.15.7 which means I can only run Xcode 12.1, but looking online I can't seem to find any reference to styling such as '.bordered' not being available on this version and so wondering if I'm missing something obvious.
Looking to upgrade my MacBook at the end of the month but would like to continue as much as possible up until then.
Any help would be appreciated, thank you.