Using Switch Statements And Case Let for Type Checking in Swift

September 8, 2018 | Swift, Control Flow, iOS, macOS, tvOS, watchOS

One thing that bothers many developers about using if statements for type checking in Objective-C is that it suggests a specific order of importance. For example, here's how you might use type checking in an Objective-C `prepareForSegue` method. This Swift version is much more concise, but we still have . . .

Downloading, Caching & Decoding Images Asynchronously with Alamofire: Part 2 (Swift 4)

August 11, 2018 | Swift, Alamofire, Networking, iOS, macOS

In Part 1 of this tutorial, I explained how to use the Alamofire and AlamofireImage libraries to asynchronously download and cache images to be displayed in a UICollectionView. At the end of that project, we still had a performance problem. UIImage by default waits until right before display to decode . . .

Downloading, Caching & Decoding Images Asynchronously with Alamofire: Part 1 (Swift 4)

August 11, 2018 | Swift, Alamofire, Networking, iOS, macOS

Downloading and caching images are common tasks in iOS development, especially when using collection and table views. In this tutorial, we're going to use the popular Swift networking library Alamofire and its companion image library AlamofireImage to build an app that displays images of Glacier National Park.

Getting Started With Vapor 3 Part 4: Using PostgreSQL

August 1, 2018 | Swift, Server-Side Swift, Vapor, macOS

In Part 3 we started working with a `Park` model and defined two endpoints that returned information about parks. We used an in-memory array to hold `Park` instances. In this tutorial we'll set up a PostgreSQL database . . .

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.