- Right-click the Review Form folder again and select New File.
- Inside of the Choose a template for your new file screen, select iOS at the top, and then Cocoa Touch Class. Then, hit Next.
- In the options screen that appears, add the following:
New file:
-
- Class: ReviewFormViewController
- Subclass: UITableViewController
- Also create XIB: Unchecked
- Language: Swift
- Click Next, and then Create.
Delete everything after the viewDidLoad() method, as we do not need all of the other code. Next, let's set up our ReviewFormViewController by adding the following after the class declaration:
@IBOutlet weak var ratingView: RatingsView!
@IBOutlet weak var tfTitle: UITextField!
@IBOutlet weak var tfName: UITextField!
@IBOutlet weak var tvReview: UITextView!
We also need to add a method when our save button is tapped. We can do this by adding the following...