Displaying stars in your custom UIControl object

So far, you have created a new UIControl subclass named RatingsView in your project. You have also assigned the class of the view object next to the 0.0 label in the Restaurant Detail screen to RatingsView. Henceforth, an instance of the RatingsView class will be known as a ratings view. In this section, you will add some code to the RatingsView class to make a ratings view display stars. Do the following steps:

  1. Click RatingsView.swift in the Project navigator.
  2. Type the following text under the RatingsView class declaration:
let imgFilledStar = Imag
  1. The autocomplete menu will appear. Choose Image Literal, as shown in the following screenshot:
  1. You'll see a placeholder graphic. Double-click ...

Get iOS 13 Programming for Beginners - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.