about the properties that are dragged out by default with an exclamation mark and why we don't need to assign a value to it at first . @IBOutlet weak var display: UILabel! because the system automatically helps you initialize it, display is a optional and has been assigned nil before use. ForOptional is usually not a question mark? But there is no difference between the actual types. It is still a optional value, and its value here may be a Uilabek type. But their usage is completely different, This is exactly what the compiler did to help you get things done. But when we change the exclamation mark to question marks, the compiler will report some error prompts. Swift Compiler error Value of optinal type ' UILabel? ' not unwrapped; Did you mean to user '! ' or '? '? , such as forDisplay.text will prompt that the object does not have a member variable called text. That means you can't give it a text message. Of course, you can unpack it when you use it, such as:Display!.text= digit This is also true. But you have to unpack it every time you use it. So it's still a table. The method generated by the system. Sdisplay is not initialized to nil at the start of the class. Only Xib is loaded by the corresponding Viewcontroller. This variable is set and initialized, and it is permanently initialized throughout the class. So these were set earlier. Attribute variables do not have to be initialized at the time of creation as they are written. And it's set up very early, After that it has been set. So this is a optional type, but it will automatically unpack the variable. In some cases, you need to get display before the UI loads, it crashes because it hasn't unpacked yet. This is called unwrapped optional.
About the auto-unpacking problem of the property system generated by the [email protected] connection