Creating a structure to represent a cuisine
To create a model object that can represent a cuisine in your app, you will add a new file to your project, ExploreItem
, and declare an ExploreItem
structure that has properties for a cuisine’s name and image. Follow these steps:
- Right-click on the
Model
folder and select New File. - iOS should already be selected. Choose Swift File, then click Next.
- Name the file
ExploreItem
and then click Create. It will appear in the Project navigator and its contents will appear in the Editor area. The only line in this file is animport
statement.The
import
statement allows you to import other code libraries into your project, giving you the ability to use classes, properties, and methods from them.Foundation
is one of Apple’s core frameworks, and you can learn more about it here: https://developer.apple.com/documentation/foundation.
- Add the following...