Using the same steps as in the previous section, create a photo entity with the following values:
Now, hit command + B to build the project; this creates the Photo class that we created in Core Data.
We cannot just store images in Core Data, as they have to be converted into data first. Therefore, we need take the image that we used in the review and convert it to binary data for Core Data to save. Then, when we pull the review out of Core Data, we will convert it back into an image so that we can display it.
For learning purposes, we are storing images in Core Data. I would stay away from doing this as much as possible, because images can be large and you can quickly fill up the user's storage. If you are using a feed, you can save the URL path to the image instead of the actual image. If the user is not online, then you can display a placeholder in its place.