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

A Note About Swift for Job Recruiters

October 16th, 2017

Filed under: Uncategorized | Be the first to comment!

Apple first showed the Swift language to developers in June 2014. At the time I am writing this, that means Swift has been out for a little over three years. That means no developer can have more than three years of Swift experience. You can’t require 5+ years of Swift experience in your job description […]

Xcode 9: Swift Refactoring

September 18th, 2017

Filed under: Xcode | Be the first to comment!

Xcode 9 adds Swift refactoring support, something Swift developers have been asking for since Swift’s introduction. Choose Editor > Refactor to access the refactoring options. Xcode 9 has the following refactoring options: Rename Extract function Extract method Extract variable Extract all occurrences Add missing abstract class overrides Add missing protocol requirements Add missing switch cases […]

Custom Notifications in Swift

September 8th, 2017

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

Notifications allow an object of one class to send a message for an object of another class to handle so the two classes don’t have to know about each other. The Cocoa framework has dozens of notifications, but you can also create your own. Using custom notifications involves the following steps: Get the notification center […]