A: This is seen in the movie "Creating Quick Connections" in Chapter 4.
The short answer:
You can either (A) type them in yourself (this is not necessary, but if you want to make it exactly the same, it's the way to do it), OR (B) now use an underscore (_) at the start of the name of the variables ( _myTextField and _myLabel) when using them.
The long (better) answer:
One of the perils of Apple frequently updating Xcode is that they often make small changes that can impact what the author has recorded.
When Simon recorded the course, Xcode used to add "@synthesize" lines for you.
Now, with the latest versions of Xcode, the @synthesize lines aren't added. Instead, they're automatically "generated" behind-the-scenes when you build the project.
And by "generated", that doesn't mean they're "added to your code"—you won't see it in the code—but generated, meaning: "During compilation, Xcode will see you have a "@property" statement in the .h file, and automatically synthesize any support for that property without you needing to have an actual "@synthesize" line in your code anymore."
This is a good thing. It makes your life a little easier. But here's the one problem you may run into.
If you let Xcode do it, it will add them slightly differently than how it used to—it will name the property's instance variable with a leading underscore. So if you're referring directly to the variable within your own code, you'd need the underscore.
When Simon recorded the course, letting Xcode add the @synthesize lines, the default behavior meant you had two variables inside the class, called: myTextField and myLabel
But now if you let Xcode do automatic synthesize, the properties are called myTextField and myLabel, and the internal instance variables they wrap are called _myTextField and _myLabel
So code like this:
[myTextField text]
or
[myLabel setText:message]
—would now work if you added the underscore:
[_myTextField text]
or
[_myLabel setText:message]
HOWEVER, here's a good rule of thumb. We could, but shouldn't, really do it that way. If you let Apple do the automatic @synthesize, just avoid using the underscore version completely.
Regard the underscore as an indicator that Apple are telling you to just leave it alone, and always use the full property name, without the underscore.
Internal within that class, we'd need to use "self" to make it explicit we're accessing a property method inside the current object:
So code like this:
[myTextField text]
or
[myLabel setText:message]
—should really become:
[self.myTextField text]
or
[self.myLabel setText:message]