Storyboard and Interface Builder
The storyboard is first introduced in iOS 5 to save time building user interfaces for the iOS applications. It is a visual representation of the user interface of an iOS app. It can be defined as the sequence of screens, each of which represents the ViewController and the Views. The transitions between two storyboard screens need a segue object, which represents a transition between two ViewControllers.
The Storyboard is built using a visual editor provided by XCode, in which we can layout and design the user interfaces of the application by adding the widgets from the media library such as buttons, views, table views, text fields, etc. All the Views will be covered in detail later in this tutorial.
Segues are used to make the transitions between two screens in the storyboard. We can set the type of transition like the model or push on the segue. In simple words, the segue is like an arrow defined on an object like a button or ViewController so that any user event on the object leads to the transition defined by the segue.
The following image shows the transition between two ViewControllers using Segue.
Sometimes, we may need to pass the data between the ViewControllers. It can be done by using prepareForSegue method, which is invoked on the View Controller when the segue is triggered. The segue can either be performed on the tap of the object on which the segue is defined or programmatically by using performSegue(withIdentifier: String) method on ViewController.