Adding your custom view to the Add New Journal Entry screen
So far, you have created a new RatingView
class in your project and configured it to set its rating
property when a star in it is tapped. In this section, you will set the identity of the stack view object above the Get Location switch in the New Entry Scene to the RatingView
class, configure an outlet for it in the AddJournalEntryViewController
class, and add code to use the rating
property’s value when creating a new journal entry. Follow these steps:
- In the Project navigator, click the AddJournalEntryViewController file. Add a new outlet for a rating view in the
AddJournalEntryViewController
class after all other property declarations:@IBOutlet var getLocationSwitch: UISwitch! @IBOutlet var getLocationSwitchLabel: UILabel! @IBOutlet var ratingView: RatingView!
- Modify the
prepare(for:sender:)
method to get the rating view’srating
property value when creating a new journal...