HStack {Text("Calculated number"); TextField("", value: $calculated, format: .number) }
HStack {Text("Calculate number"); TextField("", value: $calculator, format: .number) }
HStack {Text("Calculate way"); TextField("", value: $calculateway, format: .number)}
For the code above, Xcode will show error: Can't find $calculated, $calculator and $calculateway. How to solve this error?
Also I want to create a Label that shows word:'Result:'and a variable called calresult but I don't know how to make the Label, can anyone give me the code to create the Label I said?
I hope the Label will show these text, (calresult)means the data in calresult:
Result: (calresult)
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
TextField("Calculated number", value: $calculated, format: Float)
TextField("Calculate number", text: $calculator, format: Float)
TextField("Calculate way", text: $calculateway, format: Float)
How to solve the errors:
'Cannot find $calculated, $calculator and $calculated in scope'?
Also this Label(Maybe I don't know how to make):
Label("Result:"+$calresult, systemImage: "42.circle")
How to solve this error:
'Cannot find $calresult in scope'?
I want to import text from TextField(SwiftUI) in float format but I just have this error, the message said “Can’t turn the number of type ‘float’ to a unexpected type ‘Binding’”, if I try to run it will also send me the same error, how do I fix it?