Storyboard files describe our user interface. One storyboard file can contain multiple different screens for an app, and describe how we would navigate from one screen to another.
Let's drag three labels and call them Daily Tasks, Weekly Tasks, and Monthly Tasks and arrange them as shown below.
Add some more labels to the storyboard and set their values.
So you can see this simple list of tasks, we have three sections with headings. Now if you want to bold the headings, select the Daily Tasks label and go to the Attributes Inspector, which is the fourth icon in the Inspectors section on the right.
Select the Bold from the Style drop-down, and repeat the same steps for Weekly Tasks, and Monthly Tasks label as well.
Now let's add some functionality using a swift code, but first drag a button from Object Library, call it "Change Background" and arrange it as shown below.
By default in iOS, buttons don't have a visible outline, they are just text, but blue to distinguish them from a label with black text.
We are now in standard editor mode, and we can edit a single file at a time which is the storyboard. Click on the small highlighted button which will change the Standard editing mode into the Assistant mode.
Now, all we have is the default code which contains a Swift class called ViewController.
To make a connection from a control in the storyboard to the code file, hold down the control key, click the button, and drag over into the Swift file, and you will get connector line. Drag this inside the opening braces of ViewController class, release the mouse, and you will see the following popup.
Change the connection option to action, because we want this button to cause an action in our code, and give it a name `changeBackground`.Xcode will create a new Swift function, add a single line of simple code which will change the background color. This code will be called when that button is tapped.
@IBAction func changeBackground(_ sender: Any) {
view.backgroundColor = UIColor.lightGray
}
Either click the Play button or hit Command+R to build and run this app.
Click the Change Background button, and you will see that the background color is changed to light grey color.