Category Archives: Swift

DRY Fusion data munging kata in Swift

I worked through one of Dave Thomas’s programming exercises, called a kata, and pushed my Swift 2.2 code to GitHub. The code shows how to apply the Don’t Repeat Yourself (DRY) principle to two similar but different data processing programs. The end result of … Continue reading

Posted in Swift | Tagged , | 1 Comment

Creating an iOS Wizard UI in Swift

I published a reusable framework, written in Swift, for implementing the Wizard UI design pattern, named Wizardry. It simplifies creating a user interface composed of multiple view controllers that enables the user to complete a task. This is a particularly important UI design pattern for mobile apps … Continue reading

Posted in Swift | Tagged ,

Find keys by value in Swift dictionary

Here’s a helper method that might come in handy when working with a Swift dictionary. It finds every key mapped to a particular value. This is similar to the allKeysForObject(_:) method of NSDictionary, but it is generic so it can return … Continue reading

Posted in Swift | Tagged

Finding unused resource strings in an iOS app

If you work on an iOS or OS X app that uses Strings files to store localized display text, over time those files can accumulate entries that are no longer used. Perhaps a developer forgot to remove a resource string when refactoring … Continue reading

Posted in Swift, Tips and Tricks, Uncategorized | Tagged

Creating Tic-tac-toe in Swift: User interface

This blog post is the third and final update about my Tic-tac-toe game, written in Swift. The source code is available on GitHub: https://github.com/ijoshsmith/swift-tic-tac-toe The app now has a user interface, which allows you to play against the computer or against another … Continue reading

Posted in Swift, Tic-tac-toe | Tagged , | 1 Comment

Higher-order functions in Swift

This article reviews some very useful higher-order functions available in Swift’s standard library, by showing a simplified implementation of each function. Along the way, I’ll explain how all of the higher-order functions are based on a single loop. Let’s get higher Similar to how a rock … Continue reading

Posted in Swift | Tagged , | 3 Comments

Creating Tic-tac-toe in Swift: Artificial intelligence

This blog post is the second update about my Tic-tac-toe game, being written in Swift. The source code is available on GitHub: https://github.com/ijoshsmith/swift-tic-tac-toe Over the past week I wrote an intelligent agent which implements the Tic-tac-toe strategy devised by Allen Newell and … Continue reading

Posted in Swift, Tic-tac-toe, Uncategorized | Tagged , | 1 Comment