Adding your custom view to the Journal Entry Detail screen
At this point, you’re able to set a rating when you create a new journal entry using the Add New Journal Entry screen, but the rating you set is not visible on the Journal Entry Detail screen. You’ll add an outlet for a rating view and modify the code in the JournalEntryDetailViewController class, and you’ll add a rating view to the Entry Detail Scene.
Follow these steps:
- In the Project navigator, click the JournalEntryDetailViewController file. Add an outlet for a rating view after all other property declarations:
@IBOutlet var photoImageView: UIImageView! @IBOutlet var mapImageView: UIImageView! @IBOutlet var ratingView: RatingView! - Modify the code in the
viewDidLoad()method to set the value of the rating view’sratingproperty:super.viewDidLoad() dateLabel.text = selectedJournalEntry?.date.formatted( .dateTime.day().month(.wide).year() ) ratingView...