Your First iOS and SwiftUI App · The Swift Standard Library | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app/lessons/22

Hi,

How can we decide whether a variable needs to be a state variable or a regular variable?

and also in the examples at certain places the state variable are called with the ‘$’ sign and in some places its used without a ‘$’ sign. how do we decide when the $ sign is needed and when it is not.

I thought when we are calling a state variable we should always include the ‘$’ sign in front.

Hi :wave:

Just wondering what is better in a simple text display case - interpolation or conversion? An example being:

Text(“\(self.target)”)

vs

Text(String(self.target))

Thoughts?