@State property issue with Text

Hi All,

I was using the @State property after learning from Lesson/Challenge 11 from Chris’ lectures.
I have noticed that when we use its value for a Text in view, its value doesn’t update automatically.

I have compared my code with the solution provided by Chris and haven’t found any differences.

Can anyone please let me know if I am doing something wrong? Or there is some limitation of the platform?

Thanks in advance. Have a great day ahead!!

Regards,
Anand.

Are you trying it in the Preview or the simulator? Works perfect for me in the simulator.


Also:

When posting code to these forums, please post the code as text rather than an image. This makes it far easier to read (some of us have aging eyes!) and also makes it possible for other posters to copy/paste the code in order to test solutions and such without having to retype all your code from scratch.

To post your code as text, place three backticks ``` on the line before your code and three backticks ``` on the line after your code so that it will be formatted properly. You can also highlight an entire code block and click the </> button on the toolbar to wrap the block for you.

1 Like

Thanks for your reply. I am trying out the code on the simulator.
Any suggestions?

Did it work for you in the simulator?