Yes I call enterp() from a button. But it's not in viewdetail. It's in the main program(var some body).
var body: some View {
NavigationStack {
VStack
{
Text(" " + Date().formatted(date: .numeric, time: .omitted))
.foregroundColor(.black)
.fontWeight(.bold)
Text("Driver's Food Delivery")
.font(.largeTitle)
.fontWeight(.bold)
Image("Screenshot 2024")
HStack
{
Text("Cost")
.font(.largeTitle)
.padding(10)
Spacer()
Text("Paid")
.font(.largeTitle)
.padding(10)
Spacer()
Text("Tip")
.font(.title)
Spacer()
Text("Tip %")
.font(.title)
}
HStack
{
TextField("Cost", text: $cost)
.frame(width: 75, height: 25)
.padding(20)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.blue)
.background(Color.brown)
.cornerRadius(025)
TextField("Paid", text: $paid)
.frame(width: 75, height: 25)
.padding(20)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.blue)
.background(Color.brown)
.cornerRadius(025)
Text(tipp)
.frame(width: 95, height: 25)
.background(Color.white)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.blue)
Text(tipc)
.frame(width: 75, height: 5)
.padding(10)
.background(Color.white)
.fontWeight(.bold)
.font(.system(size: 22))
.foregroundColor(.blue)
}
VStack
{
Text (emsg)
.foregroundColor(.red)
Text (msg)
.foregroundColor(.blue)
HStack {
Text (msg2)
.foregroundColor(.blue)
Spacer()
}
Button { enterp()
}
label: { Text("Enter")
.font(.largeTitle)
.foregroundColor(.green )
}
I'm going to have text1 to text44. What else do you need to know?