Reputation: 56679
Using the Interface Builder in XCode we control drag from a textfield to the view controller Swift class resulting in this code:
@IBOutlet weak var nameTextField: UITextField!
Now I know that this field links to a specific text field on the storyboard. But how do you look at the this code and determine which textfield this nameTextField
attribute refers to?
Upvotes: 0
Views: 117
Reputation: 535304
But how do you look at the this code
There is no code beyond what you cited:
@IBOutlet weak var nameTextField: UITextField!
The trick is that the name "nameTextField"
is also written into the nib file. At runtime, the nib file is loaded and this string is used via key–value coding to match up with the nameTextField
property in the nib file's owner (here, the view controller), and the text field instantiated by the loading of the nib is assigned to that property.
Upvotes: 2
Reputation: 17556
In the editor's gutter there is a grey dot. Click on that and it will give you a link to the storyboard.
If you want to see all of the connections from Interface Builder:
Upvotes: 1