How to Check iOS or OS X Version in Swift

Mattt of NSHipster:

In Objective-C, checking for the availability of an API was accomplished through a combination of C preprocessor directives, conditionals on class, respondsToSelector:, and instancesRespondToSelector

So how do you check the system version in Swift to determine API availability? Read on to find out.