Creating model objects for the Photo Filter screen
To get the information from FilterData.plist
into your app, you'll create a structure, FilterItem
, that can store details about a filter, and a data manager class, FilterManager
, that will load FilterData.plist
and create an array of FilterItem
instances. This is similar to the method used to load cuisine and location information into your app. Let's start by creating the FilterItem
structure. Follow these steps:
- Right-click the
Model
folder in thePhotoFilter
folder and select New File. - iOS should already be selected. Choose Swift File and click Next.
- Name this file
FilterItem
. Click Create. TheFilterItem
file will appear in the Project navigator. - Inside the
FilterItem
file, type the following code after theimport
statement to declare and define theFilterItem
structure:struct FilterItem { let filter: String? let name: String? init(dict: [String...