Skip to content

Instantly share code, notes, and snippets.

@PaulTaykalo
Created October 26, 2015 18:34
Show Gist options
  • Save PaulTaykalo/bfe7e1778cc55cb730c1 to your computer and use it in GitHub Desktop.
Save PaulTaykalo/bfe7e1778cc55cb730c1 to your computer and use it in GitHub Desktop.
UpdateOnClassInjection for liver reload Componens from Componentkit
@implementation CKComponent (Injection)
- (void)updateOnClassInjection {
dispatch_async(dispatch_get_main_queue(), ^{
// Search for the first component hostig view
id comp = self;
while (comp) {
comp = [comp nextResponder];
if ([comp isKindOfClass:[CKComponentHostingView class]]) {
break;
}
}
// Emulate full update
[(id <CKComponentStateListener>)comp componentScopeHandleWithIdentifier:0 rootIdentifier:0 didReceiveStateUpdate:nil mode:CKUpdateModeAsynchronous];
});
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment