Swift For Complete Beginners Part 4: Functions

September 22, 2018 | Swift, Beginner

Functions are pieces of code that perform a specific task. A function can also be thought of as a set of instructions packaged together. In Part 1, you used the built-in Swift function `print` to output values to the console. So far you have used it to output "Hello, World!", "Hello, Xcode!", pi, and an email address. When you use a function . . .

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 . . .

A 4-Step Approach To Code Reviews

August 19, 2018 | Code Reviews

When working with a team, code reviews are critical to maintaining a consistent, high-quality codebase. Hopefully, your project has thorough test coverage and your team has a shared understanding of best practices. You may even use tools like danger or SwiftLint to enforce components of the code review process. But when it comes to architecting and . . .

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.