To understand how ORM and Fluent work, let's see how we can build models for our Shopping List app by creating our first model called Item. Using FluentProvider, we will be able to create, fetch, save, update, and delete an item object in any database we want, as long as there is a database driver available for the database we plan on using. In this exercise, we will learn to build a small Swift package, to learn how Fluent works and to understand how to save and retrieve items from the SQLite database, which is easy to get started with. To get started, follow these steps:
- Create a new folder called FluentDemo and open the folder in the Terminal.
- Initialize a Swift package using the swift package init --type executable