facebook/xctool — pull request #427 by ExtremeMan (2014-09-22 19:12:23+00:00)
Title: Improve xctool binary compatibility when switching between different Xcode versions.

Xcode 5 and Xcode 6 have different sets of private frameworks that are used by xctool. When Xcode 6 support was added it was decided to use `#if XCODE_VERSION < 0600` and `#if XCODE_VERSION >= 0600` macros to choose which source codes to compile. This approach reduced number of `NSClassFromString` and `performSelector:` usages and works perfectly when xctool.sh is used to run xctool.
But when xctool is compiled only once (for example, using Xcode 5) and then used with another Xcode version (for example, Xcode 6) it could causes crashes because during runtime xctool will decide to use classes that don't provide implementations of expected methods.

In this PR for all private classes, that exist in one version of Xcode and don't exist in another, were created *stubs* which do next:
- if original class implementation is available when xctool is built, original implementation is used (stub just inherits from original class)
- if original class implementation is not available when xctool is built, `+ (id)forwardingTargetForSelector:(SEL)aSelector` is implemented and during runtime required class from private framework is returned by calling `NSClassFromString`. Required frameworks are loaded if needed (for Xcode 6 -> Xcode 5 switch only).