Announcing Server-Side Swift with Vapor — Fully Updated for Vapor 4!

We’re beyond excited to announce that our book, Server-Side Swift with Vapor, has been fully updated for Vapor 4 — and includes a completely new chapter! By Chris Belanger.

Save for later
Share

Apple open-sourced Swift in December 2015 and, as developers will do, immediately spawned a number of web frameworks written in Swift. Over time, a large and highly-engaged user community has embraced the framework. And for good reason: Vapor has a Swift-like API and makes heavy use of many powerful language features.

As a result, Vapor has become the most popular server-side Swift framework on GitHub, with over 20,000 stars to date! And not only that, but Vapor boasts a massively supportive developer community, with a very dedicated following on GitHub and an extremely active chat server on Discord.

That’s why we’re excited to announce that our popular book on building web apps and web APIs in Swift, Server-Side Swift with Vapor, has now (finally!) been updated completely for Vapor 4 — and we’ve also added an entirely new chapter on Sign In with Apple!

Keep reading to see what’s inside, and how you can get your copy today!

What is Server-Side Swift with Vapor?

If you’re a beginner to web development, but have worked with Swift for some time, you’ll find it’s easy to create robust, fully featured web apps and web APIs with Vapor 4.

Whether you’re looking to create a backend for your iOS app, or want to create fully-featured web apps, Vapor is the perfect platform for you.

This book starts with the basics of web development and introduces the basics of Vapor; it then walks you through creating APIs and web backends; creating and configuring databases; deploying to Heroku, AWS, or Docker; testing your creations and more!

Who is this Book For?

This book is for iOS developers who already know the basics of iOS and Swift development and want to transfer that knowledge to writing server-based applications.

And that’s one of the best strengths of Vapor; it allows mobile developers to take a language they’re intimately familiar with in the mobile world, and take that exact same knowledge to the backend. Skills portability for the win!

What’s Inside Server-Side Swift with Vapor?

The chapters in the first three sections build on each other. If you’re new to Vapor, you should read them in sequence. If you’re experienced with Vapor, you can skip from chapter to chapter to learn how to use the latest features and treat this book as a reference.

Each chapter provides starter and final projects. The book is very code heavy and you should follow along with the code to truly understand it all.

The chapters in Section 4 stand alone and you can read them in any order. Written by the core Vapor team, they provide deeper insight into how best to use Vapor. But the absolute best way to learn about Vapor is to roll up your sleeves and start coding!

Server-Side Swift with Vapor takes you from beginner to expert over a massive collection of 37 chapters, spanning five sections:

Section I: Creating a Simple Web API

This section teaches you the beginnings of building Vapor applications, including how to use Swift Package Manager. You’ll learn how routing works and how Vapor leverages the power of Swift to make routing type-safe. You’ll learn how to create models, set up relationships between them and save them in a database. You’ll see how to provide an API to access this data from a REST client. Finally, you’ll build an iOS app which leverages this API to allow users to display and interact with the data.

Build your first Vapor application — and even build an iPhone app that uses your new API!

  1. Introduction: Get a quick overview of the history of the Vapor project and how the book is structured.
  2. Hello, Vapor: In this chapter, you’ll start by installing the Vapor Toolbox, then use it to build and run your first project. You’ll finish by learning about routing, accepting data and returning JSON.
  3. HTTP Basics: Before you begin your journey with Vapor, you’ll first review the fundamentals of how the web and HTTP operate, including its methods and most common response codes. You’ll also learn how Vapor differs from other Swift frameworks, its benefits, and how it can augment your web development experience.
  4. Async: In this chapter, you’ll learn about asynchronous and non-blocking architectures. You’ll discover Vapor’s approach to these architectures and how to use them. Finally, the chapter provides a small overview of SwiftNIO, a core technology used by Vapor.
  5. Fluent & Persisting Models: This chapter explains how to use Fluent to save data in Vapor applications. Fluent is Vapor’s ORM or object relational mapping tool. It’s an abstraction layer between the Vapor application and the database, and it’s designed to make working with databases easier.
  6. Configuring a Database: Databases allow you to persist data in your applications. In this chapter you’ll learn how to configure your Vapor application to integrate with the database of your choice. Currently Vapor only has support for relational (SQL) databases but this will change in the future.
  7. CRUD Database Operations: This chapter concentrates on how to interact with models in the database. You’ll learn about CRUD (Create, Retrieve, Update, Delete) operations and how they relate to REST APIs. You’ll also see how to leverage Fluent to perform complex queries on your models.
  8. Controllers: In previous chapters, you wrote all the route handlers in one file. This isn’t sustainable for large projects as the file quickly becomes too big and cluttered. This chapter introduces the concept of controllers to help manage your routes and models, using both basic controllers and RESTful controllers.
  9. Parent-Child Relationships: In this chapter, you’ll learn how to set up a parent-child relationship between two models. You’ll learn the purpose of these relationships, how to model them in Vapor and how to use them with routes.
  10. Sibling Relationships: In this chapter, you’ll learn how to implement the other type of relationship: sibling relationships. You’ll learn how to model them in Vapor and how to use them in routes.
  11. Testing: In this chapter, you’ll learn how to write tests for your Vapor applications. You’ll learn why testing is important and how it works with Swift Package Manager. Then, you’ll learn how to write tests for the TIL application from the previous chapters. Finally, you’ll see why testing matters on Linux and how to test your code on Linux using Docker.
  12. Creating a Simple iPhone App, Part 1: In the previous chapters, you created an API and interacted with it using RESTed. However, users expect something a bit nicer to use TIL! The next two chapters show you how to build a simple iOS app that interacts with the API. In this chapter, you’ll learn how to create different models and get models from the database.
  13. Creating a Simple iPhone App, Part 2: In this chapter, you’ll expand the app to include viewing details about a single acronym. You’ll also learn how to perform the final CRUD operations: edit and delete. Finally, you’ll learn how to add acronyms to categories.
Chris Belanger

Contributors

Chris Belanger

Author

Over 300 content creators. Join our team.