Skip to main content


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.

With the release of Swift 4 next week and the implementation of proposal 168 now up and running in the Swift 4 toolchain I thought it would be nice to get in and get my hands dirty with multi-line string literals to provide some examples on how standard string manipulation practices now work with multi-line string literals in Swift 4.  This tutorial will focus on some of the general operations developers use in working with and string manipulation for day to day tasks in development.

If you have ever wondered how to find a substring inside another string in Swift then hopefully this tutorial will help walk you through how to do that.  As an example, in Swift 3 or above, if you have ever wondered how to determine if the substring "Agnosticdev," is part of the parent string "Hello Agnosticdev, I love Tutorials," then this tutorial will show you how to indicate, with a boolean value, the existence of the substring.

Looking ahead to the rollout of Swift 4 on Jun 5th at WWDC I have been scanning the Swift Evolution Github page to get a feeling of which of the proposals will make the cut for Swift 4 and which proposals will push ahead to later version of Swift 4.*.  One proposal in-particular that caught my attention was proposal 168, for multi-line string literals.