Swift: Connect the UI to Source Code

ViewController

View controllers implement your app’s behavior. A view controller manages a single content view with its hierarchy of subviews. View controllers coordinate the flow of information between the app’s data model, which encapsulates the app’s data, and the views that display that data, manage the life cycle of their content views, handle orientation changes when the device is rotated, define the navigation within your app, and implement the behavior to respond to user input.

Outlet

Outlets provide a way to reference interface objects—the objects you added to your storyboard—from source code files. To create an outlet, Control-drag from a particular object in your storyboard to a view controller file. This operation creates a property for the object in your view controller file, which lets you access and manipulate that object from code at runtime.

Action

An action (or an action method) is a piece of code that’s linked to an event that can occur in your app. When that event takes place, the code gets executed. You can define an action method to accomplish anything from manipulating a piece of data to updating the UI. You use actions to drive the flow of your app in response to user or system events.