https://developer.apple.com/library/prerelease/mac/releasenotes/AppKit/RN-AppKit/index.html suggests using something like this code to check for El Capitan at runtime:
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_9) {
NSLog(@"Something old");
} else if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_10) {
NSLog(@"Yosemite");
} else {
NSLog(@"El Capitan");
}The problem is that this code when run on Yosemite outputs "El Capitan".
As far as I can tell, the NSAppKitVersionNumber on 10.10.3 is 1347, while NSAppKitVersionNumber10_10 is defined at 1343.