Skip to content

Instantly share code, notes, and snippets.

@saikat
Created September 23, 2009 09:17
Show Gist options
  • Save saikat/191857 to your computer and use it in GitHub Desktop.
Save saikat/191857 to your computer and use it in GitHub Desktop.
@import <AppKit/CPTextField.j>
var DelegateKey = @"DelegateKey";
@implementation ToolbarTextField : CPTextField
{ }
- (void)initWithCoder:(CPCoder)aCoder
{
console.log("Decoding...");
self = [super initWithCoder:aCoder];
if (self) {
console.log("Decoded delegate", [aCoder decodeObjectForKey:DelegateKey]);
[self setDelegate:[aCoder decodeObjectForKey:DelegateKey]];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
console.log("Encoding...");
[super encodeWithCoder:aCoder];
console.log("Original object", _delegate);
[aCoder encodeConditionalObject:_delegate forKey:DelegateKey];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment