I was just updating my tutorial series on developing iOS 8 apps in Swift for Beta 5, and I was looking at this bit of code: var name = result[“trackName”] as? String if !name? { name = result[“collectionName”] as? String } The code is setting name to the result[“trackName”], if it can successfully cast to…
Re-implementing Optionals using Swift’s powerful enum type.
This post updated December 6, 2014 to reflect changes in Xcode 6.2 If you’ve been messing with Swift much lately, you may have noticed that enum’s do much more than they did in Objective-C, or in most other languages for that matter. In the WWDC videos discussing Swift, one of the presenters mentions that Optionals…
Access Control In Swift
Updated December 21 for Xcode 6.1.1 The Swift feature of Access Control is really important from a software architecture perspective, because it allows us to properly implement encapsulation. Without the ability to hide members and methods of classes, it’s very easy to accidentally (or not) reach in to classes and mess with internals that were…
Drawing Custom Views With Swift – Andrew VanWagoner
One of my readers, Andrew VanWagoner, decided to put together a short tutorial that follows up the iOS 8 Swift Tutorial I put together last month. So I’m sharing it here with you all! Andrew is a Senior Software Engineer working for Adobe in Lehi, Utah. You can find out more about Andrew at his…
Running Swift Scripts From The Command Line
Swift Scripts From The Command Line This post updated for Xcode 6.1 One of the great features of swift is it’s ability to be used on the command line. It’s actually really easy to do, and I’ll show you how to make an executable Swift file in this tutorial. First let’s create a new Swift…
Making a POST request in Swift
This post updated September 16 for Xcode 6 GM Let’s say you’re working on an iOS app where you need to pass data to a server as JSON. Just about every app that interacts with a server does this, and almost always there is a login API call. For the purposes of this tutorial, I’m…
Swift: “fatal error: unexpectedly found nil while unwrapping an Optional value” errors in Swift
fatal error: unexpectedly found nil while unwrapping an Optional value Have you seen this yet working with Swift yet? If so, you’re not alone. In this post I’m going to dig in to what this means, and explain a bit about optionals in Swift. For those of you who are experienced programmers and have arrived…
Developing iOS 8 Apps Using Swift – Animations, Audio, and Custom Table View Cells (Part 7)
This section completely updated to reflect changes in Xcode 6.3, as of April 17, 2015 In parts 1 through 6 we went over some basics of Swift, and set up a simple example project that creates a Table View and a puts some API results from iTunes inside of them. If you haven’t read that…
Developing iOS 8 Apps Using Swift – Interaction with multiple views (Part 6)
This section completely updated to reflect changes in Xcode 6.3, as of April 16, 2015 In parts 1 through 5 we went over some basics of Swift, and set up a simple example project that creates a Table View and a puts some API results from iTunes inside of them. If you haven’t read that…
Developing iOS Apps Using Swift Part 5 – Async image loading and caching
This section completely updated to reflect changes in Xcode 6.3, as of April 16, 2015 In parts 1 through 4 we went over some basics of Swift, and set up a simple example project that creates a Table View and a puts some API results from iTunes inside of them. If you haven’t read that…