CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2015 |
Maintained by Conrad Kramer.
WFDistributedNotificationCenter
is a notification center for communicating between your app and your extensions.
NSNotificationCenter
userInfo
dictionariesWFDistributedNotificationCenter *center = [[WFDistributedNotificationCenter alloc] initWithSecurityApplicationGroupIdentifier:@"group.test"];
[center postNotificationName:@"UpdatedStuff" object:nil userInfo:@{@"ChangedIds": @[@3,@4,@10]}];
Add WFDistributedNotificationCenter.h
and WFDistributedNotificationCenter.m
into your project.
The traditional model for distributed notifications is client-server, where applications are the clients and a daemon (distnoted
, notifyd
, etc) acts as the server. The server receives notifications from its clients and distributes them appropriately
This model doesn't work on iOS. There isn't a daemon that supports posting rich notifications, and you can't write your own. With WFDistributedNotificationCenter
, the connections are decentralized. When applications want to listen for a notification, they create a local mach server and update a shared registry with the mach port name. Clients posting notifications read this registry and send notifications to the appropriate process. This communication happens using the public CFMessagePort
API, and the shared registry is currently stored in the app group container.
userInfo
dictionary that adheres to NSSecureCoding
, provided that the observer specifies the class in allowedClasses
WFNotificationCenter is available under the MIT license. See the LICENSE file for more info.