Mini Project 2
Applying what you’ve learned about StoryBoards, Actions & Outlets, and Segues, you are going to build a fun app! This gives you the opportunity to really get comfortable using Actions & Outlets and Segues.
Must-Haves
- At least three sets of questions to ask your user, each on their own view
- A customized message that appears after your user answers each question
Here’s an example of a completed project:
Tips
Have fun! Make sure to follow the directions in Iteration 2 really carefully!
Iteration 1 - Rough Draft
In your notebook, first jot down what types of questions you are going to ask. Trivia? Fun facts about your favorite hobby? Questions about you? Coding? Draft that all up, so when it’s time to set up the StoryBoard, you don’t have to think of what that content will be.
Iteration 2 - Views & Segues
Create as many View Controllers as you need on the StoryBoard. For each View Controller on the StoryBoard, create a ViewController.swift
file.
Follow these steps:
- Right-click on the project name in the Navigation Pane
- Select “New File” from the drop-down
- Select “Cocoa Touch Class”, click “Next”
- Name the file. It might be easiest to keep track of them if you name them
SecondViewController
,ThirdViewController
, etc. - From the StoryBoard, select the new ViewController by clicking the tiny yellow icon on top of the phone screen
- In the Identity Inspector, under Custom Class, select the name of the file you want to connect the StoryBoard with
Iteration 3 - Design Each View
Add constraints so each view on your app looks great on all device sizes. Add any color you’d like!
Iteration 4 - Actions and Outlets
Use Actions & Outlets so that your user can click their answer and see a customized response.