cannot find in scope

struct viewdetail: View { @State var text1:String = "" @State var tip1:String = "" @State var text23:String = "" @State var tip23:String = "" var body: some View { Text(text1);Text(tip1);Text(text23);Text(tip23)

}   }
func detailline(costa:inout [Double],tipa:inout [Double]) {
    print(costa,tipa)
    text1 = "125"                                                 Cannot find 'text1' in scope                       print("detail")
}
I don't know how to do this.Let's assume the view that contains enterp() is called AnotherView.
Then, in AnotherView
define a Binding
@Binding var text1ForUpdate: String  // To make it easier to understand, I've not named it text1, but you could
declare detailLine inside AnotherView
somewhere in ViewDetail you call AnotherView
pass the text1 as parameter:
AnotherView(text1ForUpdate: $text1)
Change ne name in detailLine func:
text1ForUpdate = "125"

Tell if that works now.

Please help!!

@robert0605

Please, STOP mixing all questions. You return to an older part of the post when you have full code available.

Do you understand the answers you receive or even read them ?

So, just one point left:

  • Does the code you received in the last posts work ? (It works for me, it should for you)
  • Then, close the the thread by marking the correct answer.

Yes I read all answers but I don't understand them. I didn't try the code I received in the last posts. I don't know how to try.

Can you explain this please.

Let's assume the view that contains enterp() is called AnotherView.
Then, in AnotherView
define a Binding
@Binding var text1ForUpdate: String  // To make it easier to understand, I've not named it text1, but you could
declare detailLine inside AnotherView
somewhere in ViewDetail you call AnotherView
pass the text1 as parameter:
AnotherView(text1ForUpdate: $text1)
Change ne name in detailLine func:

text1ForUpdate = "125"

Please answer.

I put all your suggestions in except for Gridrow. There were too many errors including g.size cannot be found in scope. Now I just have to put in Another View. All I did was create an array with 44 texts. Please help me.

There's too many replies in here. I'm going to post elsewhere.

We've given you complete sections of working code and shown you how to use them. You've responded that you didn't try them or don't know how to try them.

At this point, I am no longer willing to help you. I've done my best, but if you're unwilling to try our responses, why should we bother wasting our time?

i wish you well in your coding endeavours, but I cannot help you anymore.

No please help me. I got dementia. I'm willing to try your responses I just don't know how. Please just this one last time. I won't bother you anymore.

Claude31 gave you a COMPLETE solution to your problems. You should take that entire set of code and replace your code with that. What I suspect you have done is copied and pasted bits of it from these pages into your Xcode and have missed bits out - that would certainly explain why your GridRow parts failed, because you didn't see the GeometryReader that was added in further up.

it is extremely difficult to help you when we give you the solution and you hack it about and don't follow what we've given you or told you to do. We cannot help you if you cannot do the simplest of things. If g.size can't be found when you paste some code into your Xcode you should look for where g was declared. If you can't do that, then you need to read a more basic tutorial on coding.

You're right. I didn't see GeometryReader that was added further up. I'm going to try to put GridRow back in.

I did it. GridRow is back in. No errors. It looks great. Sometimes if the number in the field was too big I would get $121.... Now I get $121.75. I never get .... Also the cost field is not on the edge of the screen. Thank you.

cannot find in scope
 
 
Q