Outlet
An outlet is a variable which is annotated with the annotation "@IBOutlet
".
Example: @IBOutlet weak var label1: UILabel!
You can create a connection from a UI control to an outlet by pressing the "control" key and dragging it from the View Controller to the UI control.
When you release the mouse, the available outlets are shown.
Another way to create a connection from a UI control to an outlet is to:
► Start by selecting the UI control in the Interface Builder Editor (or the Document Outline).
► Display the connections inspector.
► Drag the cursor from the "New Referencing Outlet" to the View Controller.
► When you release the mouse, the available outlets are shown.
Another way to create the connection and the outlet at the same time is to press the "control" key and drag it from the UI control to a place inside the code of the View Controller.
When you release the mouse, a window will pop-up to let you create the connection and the outlet.
Choose "Outlet" for the connection.
To delete the connection:
► Start by selecting the UI control in the Interface Builder Editor (or the Document Outline).
► Display the connections inspector.
► In the "Referencing Outlets", click the "x" to delete the connection.