Creating a User model

To support the concept of registering for an app, we will need to first create a User model. A user, similar to a Shopping List or an Item model in our Vapor app, will be a class that contains certain properties, such as name, email, and password. When a user tries to register for our app, they will provide us with their name, email, and password, and we will take those and create a new user record if it does not already exist. In our app, we will use email as the ID by which a user can log in along with their password. Some websites or apps may even have a concept of username, which can be added as a property to the User model; however, for our app, email will suffice to serve as a unique identifier by which we can ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.