Skip to main content

Swift

Have your ever wondered how to take advantage of the cryptographic interfaces that Apple provides for you, but just unsure where to start?  If you so, then this tutorial will provide you a brief overview on how to implement the CommonCrypto APIs into your iOS or macOS application utilizing Swift 5.  In this tutorial I will cover taking a clear text Swift string and creating a MD5 and SHA-256 hashed value from this string.  Before we dive into the code though, let's talk about why you might want to use these hashing functions in your application.  One reason would be to persist sensitive inf

With daylight savings time being a few days old now for 2019 I thought I would put together a small tutorial on how to convert dates by timezone in Swift.  There are two approaches that I generally use when converting dates, the first is to use a Foundation's DateFormatter, and the second is to perform an Epoch calculation based upon your current timezone offset.  The advantage of using the DateFormatter approach is that dates can easily be displayed or evaluat

If there is one thing that I have learned in my career it's that network connectivity is not a binary state.  A network connection goes through many different transitions when setting up the connection, transmitting data, and closing down the connection.  In most cases, a client side mobile or desktop application can simply send the network request and if the client application is offline the request will immediately fail and the application can update the user accordingly (

One topic that I have seen come up a lot over the last couple of years is how to detect internet connectivity in an iOS or macOS application.  This is a topic that really interests me so I thought I would take some time and write a tutorial on how I and Apple recommend that client applications determine network connectivity.  To start, I thought I would provide some context on where this network connectivity model might be applicable.  The main use case is in a traditional client to server communication setting where a client is sending either a GET or POST request to a server, and the serv

What’s new in Swift is a news feed that focuses on the latest articles, trends, and stories happening around the Swift ecosystem that I find interesting.  All of the topics selected in this article have been cherry picked from either Github, Swift.org, or found the Swift Forums over the last few weeks and can range from topics covered in iOS, macOS, tvOS, watchOS, or in the Server Side community.

What’s new in Swift is a news feed that focuses on the latest articles, trends, and stories happening around the Swift ecosystem that I find interesting.  All of the topics selected in this article have been cherry picked from either Github, Swift.org, or found the Swift Forums over the last few weeks and can range from topics covered in iOS, macOS, tvOS, watchOS, or in the Server Side community.

What’s new in Swift is a news feed that focuses on the latest articles, trends, and stories happening around the Swift ecosystem that I find interesting.  All of the topics selected in this article have been cherry picked from either Github, Swift.org, or found the Swift Forums over the last few weeks and can range from topics covered in iOS, macOS, tvOS, watchOS, or in the Server Side community.  This latest issue focuses on SourceKit-LSP, adding Python 2 and 3 support to the Swift stdlib, a

In years past Apple has announced their new operating systems, developer tools, and environments at WWDC and then in the fall final versions would be released to the entire developer base.  Today, it is a whole new world in that the Swift language has mostly diverged from this pattern and is released on a community driven time schedule.

In mid-December of 2017 a proposal went into review for the Swift language entitled, “SE-0192 – Non-Exhaustive Enums.”  In this proposal the Swift core team outlined a change to allow switch statements that consume enum types to be non-exhaustive or exhaustive, depending upon their needs.   The motivation behind this change was to allow for the easier additions to C based Enums in Apple or third party libraries without creating source breaking changes in projects downstream.

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.