Here is the whole code @Claude31
import SwiftUI
public var calculated = 0.0
public var calculator = 0.0
public var calculateway = ""
struct Panel: View {
var body: some View {
VStack {
Image(systemName: "person")
.imageScale(.large)
.foregroundColor(.red)
HStack {Text("Calculated number"); TextField("", value: $calculated, format: .number) }
HStack {Text("Calculate numebr"); TextField("", value: $calculator, format: .number) }
HStack {Text("Calculate way"); TextField("", value: $calculateway, format: .number)}
}
}
}
public var calresult = 0.0
public func calculate() {
if calculateway == "+" {
calresult = Double(Float(calculated + calculator))
}
else if calculateway == "-" {
calresult = Double(Float(calculated - calculator))
}
else if calculateway == "*" {
calresult = Double(Float(calculated * calculator))
}
else if calculateway == "x" {
calresult = Double(Float(calculated * calculator))
}
else if calculateway == "X" {
calresult = Double(Float(calculated * calculator))
}
else if calculateway == "divided by" {
calresult = Double(Float(calculated / calculator))
}
}
struct Result: View {
var body: some View {
VStack {
Label("Result:", systemImage: /*@START_MENU_TOKEN@*/"42.circle"/*@END_MENU_TOKEN@*/)
.labelStyle(.titleOnly)
}
}
}