Fluent in action

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:

  1. Create a new folder called FluentDemo and open the folder in the Terminal.
  2. Initialize a Swift package using the swift package init --type executable

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.