Skip to content

Instantly share code, notes, and snippets.

@depth42
Last active December 25, 2015 00:09
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save depth42/6886194 to your computer and use it in GitHub Desktop.
Save depth42/6886194 to your computer and use it in GitHub Desktop.
The xib compiler in Xcode 5.0.1 always sets the scaling bit of all NSViews which results in dramatically reduced performance. Until Apple fixes this severe bug, we work around this by patching NSKeyedUnarchiver to clear the bit during decoding of the compiled xib files. By the way: We filed this bug three months ago under rdar://14359398.
@interface NSKeyedUnarchiver (Xcode5Fix)
@end
@implementation NSKeyedUnarchiver (Xcode5Fix)
+ (void)load
{
[self exchangeInstanceMethod:@selector(decodeInt32ForKey:)
withMethod:@selector(xcode5Fix_decodeInt32ForKey:)];
}
- (int32_t) xcode5Fix_decodeInt32ForKey:(NSString*)key
{
int32_t value = [self xcode5Fix_decodeInt32ForKey:key];
if ([key isEqualToString:@"NSvFlags"]) {
if (value & 0x400)
NSLog (@"Removing scaled flag from NSvFlags: 0x%X", value);
value &= ~0x400;
}
return value;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment