Adding support for touch events
At present, the RestaurantDetailViewController class has an outlet, ratingsView, connected to a ratings view in the Restaurant Detail screen. It displays a rating of three and a half stars, but you can't change the rating. You will need to support touch events to make the ratings view respond to taps.
Important information
You can learn more about handling touches at https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/handling_touches_in_your_view.
To support touch events, you'll modify the RatingsView class to track the user's touches on screen and use them to determine the rating. Follow these steps:
- Click
RatingsView.swiftin the Project navigator and add the following after thedraw(_:)method:override var canBecomeFirstResponder: Bool{ return true }canBecomeFirstResponderis aUIControlproperty that determines whether an object can become the first responder...