Availability checking was already in use by Xcode. But with Swift 2.0 it has this feature built directly into the compiler. This ensures you will not be able to use unavailable APIs on a given deployment target.

Swift utilizes availability checking in two different ways. As a condition in an “if”, “guard”, or “while” statement, or as a declaration attribute.

Usage in a conditional statement:

Screenshot from The Swift Programming Language book.

The platform name may be any of the following.


With Swift 2.0 the defer statement ensures code is executed regardless of how the current scope exits. This keeps any “clean-up” code nice and tidy, right next to the initial opening calls without having to repeat yourself for any early exits. WWDC 2015 session “What’s New in Swift” gives a short example I will outline here.

The example they give is you may have a method like this…

At the beginning you start something; in this case you notify the delegate. At the end you notify the delegate again. This seems simple enough, but when you add in multiple exit…


Swift 2.0 brings a lot of new changes to the programming language but some of the most talked about changes are error handling and the guard statement. @natashatherobot has a great post where she shows an example that includes both. Just these two improvements can help your code become more efficient, maintainable, and easier to read.

Screenshot from The Swift Programming Language book.

The guard statement is one of three branch statements in Swift. The other two being the if statement, and the switch statement. It is composed of a conditional statement, a constraining where statement (if you need it), and a required else for when the…


When you invest, you should buy things at a discount. Benjamin Graham, recognized as the father of value investing, widely touted this. Warren Buffett, one of Graham’s students at Columbia University, is now recognized as one of the most successful investors of all time. And it is thanks to these basic underlying principles of value investing.

1. Companies Have Intrinsic Value

Every company has a true value, otherwise known as its intrinsic value. It is based on all tangible and intangible aspects of the business. …


Why?

I frequently find myself referring to relevant WWDC sessions and linking to their videos.

How?

Obviously the new hotness is Swift scripting, I just decided to add Automator to the mix.

What?

A brand spankin’ new Automator service running a swift script.

So What?

Before I had to move to a new window highlight the link, copy the link, and move back, and paste it. Now I can just type: 2015 408, highlight it, and press a hotkey.

Not having to move from one screen to another and back again makes this a much better experience.

Here’s the goods…

Download the Automator service, Xcode project, and compiled…


A few days ago I watched a talk given by Ayaka Nonaka on Swift Scripting. If you haven’t seen it yet, I highly recommend it! She describes how Venmo took advantage of Swift scripting to optimize their workflow with designers. Using a category, or an extension in Swift, for UIImage should be a required practice. Now let’s get down to business.

Session 411: Swift in Practice explains using strong types for UIImage as well as segue id’s. Check it out. Or follow along here for the image bit…

So first I needed some images…and I needed to figure out how…


Recently I was reintroduced by Krakendev.io to this little gem. Being able to turn your // TODO: style comments into warnings and errors. They also don’t effect the build’s result which is awesome. It keeps you focused on things that *need* to be done.

I edited the script a little to include older comment formats as well as a custom // WARNING: comment.

Here’s the gist:

https://gist.github.com/iJoeCollins/9323f40a82c8628e3ae5.js

All you have to do is paste this baby into a Run Script Phase in your targets Build Phases tab.

Here’s the post over at Krakendev.io: http://krakendev.io/blog/generating-warnings-in-xcode

Happy coding!

Follow me @iJoeCollins on twitter.


So the first programming language I learned was an Object Oriented Programming (OOP) language. It was easy to think this way because we live in an object oriented world. It is always changing. That’s what makes life beautiful, and yet chaotic. We hold on to things we value. But we can’t always control what happens to them. Functional programming aims to eliminate the side-effects of life by making change intentional.

*Same* Data In, *Same* Data Out

Recently the software development community has been taking focus on functional programming (FP) for its strength in performing stateless tasks concurrently. Facebook is using…


If you followed my last post I encouraged you to dive into the session 402 with my accompanying playground file. Download the intermediate playground here.

In session 403 — Intermediate Swift, Brian Lanier and Joe Groff build upon the previous session introducing more in depth use of optionals, memory, init, closures, and pattern matching.

Some highlights include:

  • optional binding directly to variables from the function.

Joseph Collins

iOS Developer and Designer — Find me at http://ijoe.co and follow @iJoeCollins

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store