Skip to main content

Tutorials

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 a list of custom objects by property then this tutorial is for you.  It seems like there is always a need to sort and manipulate custom objects by property and that was my why I wanted to write this tutorial.  To demonstrate how to take a custom list of objects and sort those objects by a specific property.  In the case of this tutorial I have chosen to use a date property because sorting by date is a very real world example of something you may run into in the work place, but the same code would also work for numbers or

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.

If you have ever wanted to know how to open a file using Python, but were unsure of the syntax, or exactly how Python works with files, then this tutorial is aimed at you.  This tutorial aims to walk you through the basics of how to use Python to open a file using two different real world scenario's.  The first scenario I walk through how to use Python to open a file from the command line using the file as a command line argument passed in from STDIN.  The second scenario I use Python to open a file that is referenced from a file path anywhere in your program.