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.swift
, 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.swift
, and then click Create. It appears in the Project navigator. Click it, and its contents will appear in the Editor area. The only line in this file is animport
statement.Important Information
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 code to the file to declare a...