Making iOS Document-Based Apps

November 12th, 2018

Filed under: iOS Development | Be the first to comment!

I have a two-part tutorial on making document-based iOS apps over at Swift Dev Journal. Part 1 Part 2


Imported and Exported UTIs

October 24th, 2018

Filed under: iOS Development, Mac Development, Xcode | Be the first to comment!

If you create a document-based app project in Xcode, select the app target in the project editor, and click the Info button, you will see sections for imported and exported UTIs. If you have any of the following questions: What is a UTI? When would I use an imported UTI? When would I use an […]


Supporting Dynamic Type in iOS Text Views

September 10th, 2018

Filed under: iOS Development | 1 comment

Dynamic Type on iOS lets people adjust the size of text to make text easier to read. Someone with poor eyesight can use larger text if the app supports Dynamic Type. You can support Dynamic Type in your iOS app without writing any code. You have to do the following things: Use plain text in […]


Creating a Keyboard Input Accessory View

August 10th, 2018

Filed under: iOS Development | Be the first to comment!

In this article you’ll learn about keyboard input accessory views and how to add them to your iOS app to make text editing smoother. Adding a keyboard input accessory view isn’t too difficult. Add a new xib file to your project for the view. Load the view from the xib file. Set the input accessory […]


Make UIDocument File Wrapper Appear as Single File

August 3rd, 2018

Filed under: iOS Development | 1 comment

I was recently working on an iOS document-based app that saves the document in a file wrapper. When I looked in the document browser, the document appeared as a folder instead of a single file. For Mac document types Xcode has a checkbox to select to make the document appear as a single file, but […]


Getting Started with Unit Testing in Swift 4

June 13th, 2018

Filed under: Cocoa, iOS Development, Mac Development, Xcode | Be the first to comment!

One of the most read articles on this blog is An Introduction to Swift Unit Testing. The article is almost four years old and uses Swift 1. Because of that I have decided to build upon that article here, updating the code to Swift 4 and adding an example project to unit test. The Project […]


Handling Swipe Gestures in a SpriteKit Game

February 16th, 2018

Filed under: Game Development, iOS Development | Be the first to comment!

When you create a SpriteKit Xcode project, the GameScene.swift file contains functions to handle touch and/or mouse events, depending on the type of SpriteKit project you create. You can also use swipe gestures in SpriteKit games. Supporting swipe gestures requires you to perform two tasks. The first task is to create a swipe gesture recognizer. […]


Swift Functional Programming: Pure Functions

January 15th, 2018

Filed under: iOS Development, Mac Development | 2 comments

A pure function doesn’t reference any data outside of the function. If you supply a given input to a pure function, it always returns the same value. The following is a simple example of a pure function: func increment(value: Int) -> Int { return value + 1 } The increment function is pure because it […]


Swift First Class Functions

January 12th, 2018

Filed under: iOS Development, Mac Development | Be the first to comment!

I considered writing an article about first class functions in Swift, but I came across the following article by John Sundell: First class functions in Swift Sundell’s article covers pretty much everything I would cover in an article on first class functions. The examples are good too. So I decided to link to his article […]


Swift Functional Programming: reduce

January 8th, 2018

Filed under: iOS Development, Mac Development | Be the first to comment!

The reduce function takes all the elements of a collection and combines them into a single value. Supply an initial value and a function or closure (unnamed function) to combine the elements. The following code demonstrates how to calculate the average for a collection of test scores: let testScores = [78, 96, 48, 65, 59, […]