daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var WidgetJSON = @"WidgetJSON";
  2. @implementation Screen (CPCoding)
  3. - (id)initWithCoder:(CPCoder)aCoder
  4. {
  5.   // This code will only work when this screen is in the main window - that should
  6.   // always be the case
  7.   var jsonObject = [aCoder decodeObjectForKey:WidgetJSON];
  8.   return [[CPClassFromString(jsonObject.widgetType) alloc] initFromJSON:jsonObject];
  9. }
  10.  
  11. - (void)encodeWithCoder:(CPCoder)aCoder
  12. {
  13.   [aCoder encodeObject:[[self toJSON] objectFromJSON] forKey:WidgetJSON];
  14. }
  15.  
  16. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top