Skip to content

Instantly share code, notes, and snippets.

@nicklockwood
Created December 12, 2013 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicklockwood/7928676 to your computer and use it in GitHub Desktop.
Save nicklockwood/7928676 to your computer and use it in GitHub Desktop.
How to add NSURL support for FastCoding v 2.0 (this is a giant hack and will probably be unnecessary in a future release)
@interface FCURL : NSObject
@property (nonatomic, copy) NSString *absoluteString;
@end
@implementation NSURL (FastCoding)
- (Class)classForCoder
{
return [FCURL class];
}
@end
@implementation FCURL
- (id)awakeAfterFastCoding
{
return [NSURL URLWithString:self.absoluteString];
}
@end
@nicklockwood
Copy link
Author

The only problem with this is that because is smashes the classForCoder method on NSURL, it breaks NSCoding support for NSURL. You could fix this by implementing NSCoding on FCURL - but since it's only a temporary hack I wouldn't worry about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment