Skip to main content


Writing unit testing is a cornerstone of software development.  When developing mobile or desktop applications, unit testing becomes even more critical, as there is often vital business logic that needs to be validated.  Have you ever found yourself wondering; what makes a great unit test in Swift? What key components give my application enough testing coverage to make sure that everything works and nothing regresses when new code is added to my project?  If you have asked yourself these questions then you are not alone.  In fact, that is why I wanted to write this tutorial.

When the Swift language went into development one of the goals it set out to achieve was to provide a better developer experience than the one that currently existed and to provide long term support against legacy C and Objective-C APIs.   Now that these goals have been achieved the Swift community is widening it's support to working with dynamic languages such as Python, Ruby, JavaScript, and Perl in Swift 4.2's language addition for Dynamic Member Lookups.  Providing support for these

Debugging network issues no matter what platform you are on can be challenging.  Often, the deeper you dig into the operating system the harder it can be to analyze and accurately interpret the network traffic you are seeing. And working with iOS is no different.  Debugging iOS traffic from a device to a router or from a device to a server can present many challenges.

A few weeks ago Apple released a new open source framework on GitHub called Swift-NIO.  What is Swift-NIO? The opening line on GitHub describes the project as a cross platform, event driven, non-blocking, application framework to develop high performance networking applications in Swift.  So what does that mean? That means that Apple has developed a foundational project for any application that may need take advantage of an asynchronous networking framework, similar to that of Node.js.

If you are like me and have ever found yourself wondering, "what is the exact syntax on how completion handlers are setup in closures?" Then this tutorial is for you.  I wrote this tutorial with the idea in mind that sometimes it is nice to have a resource to reference when writing and defining completion handlers in your Swift project.  I also wanted to provide a quick reference on how to setup a completion handler as a function and as declared constant.  So all you have to do is make the decision about what makes the most sense in your project.


Have you ever found yourself trying to remember the syntax on how to grab the first few characters from the start or end a string in Swift 4.  Well, I certainly have from time to time and that is why I wanted to write this tutorial. To show you the reader how to grab the first few characters from the start or the end of a Swift string using only two Swift Standard library methods, and from there show one more slightly advanced technique.  So by the end of this tutorial you should be able to get the first few characters from the start or the end of a string in either Swift 3 or 4.

If you are like me and sometimes you forget the syntax on how to sort an object by a custom property then this tutorial is aimed at you.  The goal for this tutorial is to show you how to sort custom objects in Swift by a date property.  But that's not it!  One of the major reasons why the API used in this tutorial is so versatile is because it can also be extended out to other properties on a custom object like a string property, for example.  So by the end of this tutorial you should be able to sort collections of objects by either date or string properties in either Swift 3 or 4.

Have you ever found yourself in a situation where you needed to test the networking functionality on your iOS or macOS app over a period of time to see how it reacts?  Have you ever found yourself questioning whether or not network conditions during a specific time of day would play an impact on your application's performance or whether it was all just a coincidence?  Well, I recently have, and these are real questions that I found myself trying to test and answer with measurable consistent results.  Measurable results that will allow me to make the most informed decisions possible on my ne

When Swift was announced back in 2014 I can remember thinking that I needed to make a pivot in my development approach and take all of my Objective-C knowledge and apply it towards developing in the Swift programming language going forward.  At first, I thought Swift would be a one-for-one replacement of Objective-C and there would not be much of a difference in the development process other than the syntax.

One of the nice new feature enhancements in Swift 4 this year is Proposal 172 for One-sided Ranges. Proposal 172, in Swift Evolution, now simplifies collection manipulation by giving developers the option to pick from using the verbosity of the start and endIndex or using the newly implemented syntax that infers the start and end index for you.