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, […]


Swift Functional Programming: map

January 3rd, 2018

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

The map function takes all the elements in a collection and applies a function or a closure (an unnamed function) to them. The following code demonstrates using map to multiply each element of an array by itself: let numbers = [1, 2, 3, 4, 5] let squares = numbers.map { return $0 * $0 } […]


Swift Functional Programming: filter

December 27th, 2017

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

I’m learning about functional programming in Swift. To sharpen my understanding I’m writing about what I’ve learned. I start with the filter function. The filter Function As its name indicates, the filter function filters out the elements of a collection that don’t meet a condition. The filter function operates on a collection, such as an […]


Saving Settings with Core Data Metadata

November 6th, 2017

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

I’m working on a Core Data app where I needed to save some document settings. Creating Core Data entities for these settings was overkill. In my research for a solution I discovered persistent store metadata. I did not find much information online on using persistent store metadata so I’m sharing what I learned in this […]