Start Developing iOS Apps (Swift)--@IBOutlet weak var nameTextField: UITextField!的意义

@IBOutlet weak var nameTextField: UITextField!

The IBOutlet attribute tells Xcode that you can connect to the nameTextField property from Interface Builder (which is why the attribute has the IB
prefix). The weak keyword means that it’s possible for that property to have no value (be nil) at some point in its life. The rest of the declaration declares a variable of type UITextField named nameTextField.
Note the exclamation point at the end of the declaration. You may remember seeing these at the end of some types in the AppDelegate.swift file. This exclamation point indicates that the type is an implicitly unwrapped optional, which is an optional type that will always have a value after the value is first set.

你可能感兴趣的:(Start Developing iOS Apps (Swift)--@IBOutlet weak var nameTextField: UITextField!的意义)