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()
It is not possible to have logic around the #available statement.
Indeed, the statement is used by the compiler to infer what methods can be called within the scope it embraces, hence nothing can be done at runtime that would conditionally execute the block.
It is possible though to combine conditions, using a comma, as follows
if #available(iOS 8.0, *), myNumber == 2 {
// some code
}