Created
December 12, 2013 14:24
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.