title: Check OS version using Swift on Mac OS X
body: <p>I'm building an application that needs to check what version of OS X is installed on a Mac. It is built against 10.9 Mavericks, but all of the Swift APIs are pretty much 10.10 only.</p>
  
  <p>I'm trying to use the following, however it does not compile against the 10.9 SDK since it does not have these APIs, I know how to use <code>if #available(OSX 10.10, *)</code> to conditionally compile as per the different versions, however because <code>NSProcessInfo</code> is a 10.10+ API I can't use it to check to see if the Mac is running 10.9. This is the code I have so far (however it does not compile against the 10.9 SDK):</p>
  
  <pre><code>let osVersion = NSProcessInfo.processInfo().operatingSystemVersion
  if osVersion.minorVersion == 9 {
      //  Do something for OS X 10.9 Mavericks
  } else {
      // Do something for anything not Mavericks (10.10+)
  }
  </code></pre>
  
  <p>Is there another way to check what OS the Mac is running in 10.9? Essentially I could wrap the above code with:</p>
  
  <pre><code>if #available(OSX 10.10, *) {
      let osVersion = NSProcessInfo.processInfo().operatingSystemVersion
      // Check OS version
  } else {
      // Check OS version using a 10.9 API
  }
  </code></pre>
  
  <p>I just don't know what to fill in for the <code>// Check OS version using a 10.9 API</code> section of that code block.</p>