Hey buddy what's going on this is Caleb with slopes dot com and in this video we're going to go ahead
and create our no model but we're also going to create some dummy data to load in our table view and
we're also going to create an enumeration called Lock status to help us determine whether or not a cell
should show a particular image or not.
So go ahead and pull open your X code project just like so.
And what we're going to do is we're going to right click on our model folder we're going to go ahead
and click new file and we're going to create a swift file.
So click on swift click on next and go ahead and name this note.
OK.
Create it.
And now what we can do is we can create a class called note we can create some properties and we can
also go ahead and initialize them.
So call a class note like so.
And now inside we're going to create two properties message and lock status.
The message of course is going to be the text of the note and the lock status is going to be either
locked or unlocked.
OK.
So go ahead and call public private set
var message ok of type string.
And the reason we're using public private set is because we want the message to be publicly accessible
but we don't want to be able to change the message from any other class other than this one when we
create the note.
Now that's not the same for the lock status.
OK the lock status we do want to be able to change.
So for that one I'm just going to go ahead and call this public var lock status.
But this needs to be of a custom type.
We need an enumeration called Lock status that has two cases locked and unlocked.
So right click on the anime's folder and click new file click swift file name it lock status and press
create.
Now inside this we're going to go ahead and just say ENM lock status and we're going to go ahead and
create two cases like I said case locked and case unlocked.
OK.
So now we can give it a value locked or unlocked.
Pretty cool to go into note.
Go ahead and give it a lock status of type lock status and of course that may not show up until you
build the project.
As you can see it is now.
But now it's complaining that we have no initializers.
So go ahead and call in.
Like so pasan a message of type String pass in a lock status of type lock status like so then we're
going to set self Dopp message to be equal to message and self-doubt lock status to be equal to lock
status just like that.
OK so now we have a note class that we can use to create an instance of note and we're going to do that.
So let's go ahead and let's go into our helper's folder like so.
And we're going to create a new file.
So go ahead and create a swift file and we're going to just call this note.
Objects can go ahead and click create to create that.
OK so what we're going to do is we're just going to create an array of three instances of note.
And this is going to be our static data that we're going to use to fill our table view.
Now of course this app would be much better if you could add your own notes and you could save them
using Core data or some other persistence method.
But just for the purposes of this app we've got to get to touch I.D. and face I.D. soon.
So I'm just going to make some static data to speed things up here so go ahead and write var notes array.
And that's going to be an array of type.
Note we need to explicitly say that it is and that's going to be an array of type note.
So let's create some notes first let's say var.
Note 1 is going to be equal to note.
And we're going to instantiate it with a message and a lock status.
So the message will be dev slopes is a really amazing platform to learn to code.
Check it out at Dev slopes dot com
sweet and let's give it a lock status we're going to set it to be locked by default.
OK let's create a second note.
Var notes too.
It's going to be equal to note.
And we're going to pass in another message so let's say I love learning about Touch ID and face ID at
the same time.
Thanks Apple for making such amazing framework's.
And you know what let's put in a little Moji here just for fun little heart.
There we go.
And we're going to set a lock status of unlocked just because why not.
Now let's make a third instance here var note three equals note.
And of course you could go on and on you could make more than three notes but I'm going to make three
and this will say
all right stop collaborate and listen
devs slopes back with a brand new invention.
Why not.
OK.
And then we're going to set a clock status of locked Let's lock that one down.
So we have three instances of note two with a locked status one with an unlocked status.
And now to create our array we just need to pass in no one comma no two comma and note three.
So now we have a static array of notes that we can use Well OK it's not static.
I haven't declared it is static but it is going to be just an instance that we can use to pull data
and displayed in our table view.
So we're now at a good place to actually move on to creating our notes cell and then setting up our
table view to pull data from this note's array and display it.
Pretty cool stuff.
So let's head over to the next video where we're going to build out notes cell its subclass and we're
going to wire it up with the proper IP outlets that it needs so let's head over that way now and let's
do it.