i have shared core data backing iphone app , watchkit extension. both function independently, i'm worried concurrent use.
in extension, have uitableview
has array of data. right grabs array shared core data during -awakewithcontext
.
i want have sort of communication between app , extension when record created/updated/deleted can duplicated on other side (instead of on next query core data).
this question, how send data iphone watchkit in swift, goes iphone having handler when happens in watch, i'm more concerned going other way. right can think of querying core data pretty take care of it.
a common solution , 1 of ways use mmwormhole.
mmwormhole uses cfnotificationcenter communicate changes instantaneously across app , extension, passing information through shared application groups.
example of passing data through mmwormhole github readme:
// sender (watch extension) [self.wormhole passmessageobject:@{@"buttonnumber" : @(1)} identifier:@"button"]; // receiver (phone) [self.wormhole listenformessagewithidentifier:@"button" listener:^(id messageobject) { self.numberlabel.text = [messageobject[@"buttonnumber"] stringvalue]; }];
Comments
Post a Comment