Getting Started With Vapor 3 Part 3: Basic Routing

July 28, 2018 | Swift, Server-Side Swift, Vapor, macOS

In Part 2 we explored the basic structure of a Vapor app. Next we'll look at how to declare simple routes with dynamic path components and query parameters. Our API will model information about U.S. national parks, so we'll start by declaring a simple `Park` model. For now, we'll keep an array of parks in memory and define two routes.

Making Views More Testable & Reusable

July 22, 2018 | Swift, Unit Testing, iOS, macOS, tvOS, watchOS

In this tutorial, we'll see how we can use protocols to make custom view subclasses more generic. The benefit is that they'll be easier to test and reuse, and our code will be easier to read and maintain.

Getting Started With Vapor 3 Part 2: Vapor App Structure

July 5, 2018 | Swift, Server-Side Swift, Vapor, macOS

In Part 1 we saw how to install Vapor and create an Xcode project using the default `api` template. That project comes with a lot of code demonstrating the basics of building an API in Vapor. It uses SQLite as the database and a `Todo` model and controller as an example. Our app will eventually use PostgreSQL . . .

Getting Started With Vapor 3 Part 1: Installing Vapor and Creating A Project

July 5, 2018 | Swift, Server-Side Swift, Vapor, macOS

Vapor is a web framework for Swift. It runs on macOS, iOS, and Linux, and can be used to build websites, web applications, and APIs. Frameworks like Vapor make it possible to build entire products in Swift, including a backend, web app, marketing site, and Apple device app (iOS, macOS, tvOS, watchOS).

Understanding Hashable, Equatable, and Set Membership

July 1, 2018 | Swift, Protocols, Collections, iOS, macOS, tvOS, watchOS

The `Hashable` protocol in the Swift Standard Library allows us to use our own custom types as a key in a dictionary or as a member of a set. Conforming to `Hashable` where appropriate can make our code safer and improve performance. However, it's important to understand how `Hashable` and `Equatable` work together . . .