Skip to main content

Swift

Swift 4 is packed with all kinds of great updates to the Swift Standard Library's Dictionary type thanks to the great work put in by Nate Cook to enhance the Dictionary and Set types in proposal 165 of Swift Evolution.

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.

A topic that I have been hearing a lot about lately is the MVVM design pattern.  MVVM stands for Mode-View View Model and is intended to solve some of the concerns that have resulted from using the MVC design pattern - specifically in the context of iOS.  While MVVM is certainly not an iOS specific design pattern, I did conduct some further research into MVVM using iOS as my research platform because I I wanted to try and figure out if MVVM could be a design pattern that fixes some of the issues that I have run into when developing large MVC iOS applications.

Today I was analyzing a potential bottleneck in some computation I was doing with Swift and thought I would try a basic linked list data structure to store data instead of an array.  It soon dawned on me that I have never created a linked list in Swift before and thought this might be a good opportunity for a Swift Playground to test out my idea.  Sure enough, using Playgrounds was a great way to test out my code and make sure it was running the way I wanted it to before integrating it into my project.

Last week I started building an iOS application in Swift 3.0 and Xcode 8 and was able to get a good portion of the application completed.  Towards the end of last week I became aware of the need to integrate a Unity / Vuforia exported project into my existing iOS Swift project to enable an augmented reality feature in the iOS application I was working on.

The other day on Twitter I seen mention of the Taylor Series and it made me think back to calculus and how much I enjoyed the Taylor and Maclaurin series because learning about them was my first exposure into series and sequence approximations.