iOS Swift 2.0 and later


Example

if #available(iOS 9, *) {
  // iOS 9
} else {
  // iOS 8 or earlier
}