Skip to content

Instantly share code, notes, and snippets.

@onlyyoujack
Forked from mattwymore/versionMacros.h
Created July 1, 2016 09:34
Show Gist options
  • Save onlyyoujack/8ff63f328c856569c653d432ec51d9f9 to your computer and use it in GitHub Desktop.
Save onlyyoujack/8ff63f328c856569c653d432ec51d9f9 to your computer and use it in GitHub Desktop.
Macros for comparing iOS Version numbers. See: http://stackoverflow.com/questions/3339722/check-iphone-ios-version for more discussion
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment