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.
I see a lot of discussion on the internet about the usage of weak, and unowned objects in Swift. Recently, I was involved in a thread on Stack Overflow discussing the proper usage of weak references and it occurred to me that since I see so much discussion about this topic it would be good to write a post detailing my understanding on the usage of weak references.
How and why Swift started at Apple is still a bit of a mystery to the outside world and has been the focal point of many rumors and speculation over the years. If I had to pick one place where there is solid evidence of Swift’s roots at Apple, it would have to be with Chris Lattner. Chris Lattner is the internal founder of the Swift language at Apple, with a claim from Lattner on his personal website that the language dates back to 2010 internally at Apple.