I want to execute a code block only on devices running with an OS older than iOS8. I can\'t do:
if #available(iOS 8.0, *) == false {
doFoo()
simple way to check is to create the function
func isNewFeatureAvailable() -> Bool {
if #available(iOS 9, *) {
return true
} else {
return false
}
}
Use:
if isNewFeatureAvailable() {
// use new api
} else {
// use old api
}
OR just use inline
if #available(iOS 9, *) {
// use new api
} else {
// use old api
}