Skip to content

Instantly share code, notes, and snippets.

@Redth
Created January 27, 2014 14:56
Show Gist options
  • Select an option

  • Save Redth/8649907 to your computer and use it in GitHub Desktop.

Select an option

Save Redth/8649907 to your computer and use it in GitHub Desktop.
NSData Selectors
@implementation NSData (AirfoilIntegrationSampleAdditions)
+ (id)scriptingAirfoilImageWithDescriptor:(NSAppleEventDescriptor *)descriptor
{
if ( [descriptor descriptorType] == typeType && [descriptor typeCodeValue] == cMissingValue )
{
return nil;
}
if ( [descriptor descriptorType] != typeTIFF )
{
descriptor = [descriptor coerceToDescriptorType: typeTIFF];
if (descriptor == nil)
{
return nil;
}
}
return [descriptor data];
}
- (id)scriptingAirfoilImageDescriptor
{
return [NSAppleEventDescriptor descriptorWithDescriptorType: typeTIFF data: self];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment