Category Archives: Uncategorized

Simple deep linking in Swift

If you need to support deep links with a custom URL scheme in your iOS or tvOS app, check out my tidy little API to help convert URLs into deep link objects. It’s written in Swift 3. I published it on … Continue reading

Posted in Swift, Uncategorized | Tagged ,

Reflectable enums in Swift 3

Suppose you are working on a Swift program that needs a data model to represent a contact, such as a person from the user’s address book or a FaceBook friend. You might start off by modeling this as a Contact … Continue reading

Posted in Swift, Uncategorized | Tagged | 10 Comments

Generate Equatable code in Swift

Here is my Swift 3 utility function for turning a live class/struct instance into Equatable protocol code for that type: https://github.com/ijoshsmith/equatable-code-generator Here’s to never writing that kind of code ever again!

Posted in Uncategorized | Tagged | 1 Comment

Function composition in Swift

The way that functional programming languages allow functions to be combined can help make code easier to read and understand. The technique is known as function composition. I show how to compose functions in Swift 3 using custom operators, including a … Continue reading

Posted in Uncategorized | Tagged , | 1 Comment

Stones on a beach

Suppose that you arrange stones into a spiral on a sandy beach. After meticulously arranging your stone spiral, the world seems hell-bent on destroying it. A dog steps on some of the stones, a big wave carries some of them … Continue reading

Posted in Thoughts, Uncategorized | 8 Comments

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