PLObservers 1.0.0

PLObservers 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2015

Maintained by Antoni Kedracki, Polidea.



Small tool for fast implementation of multi-observer pattern in Objective-C

Usage

Given you have a observer protocole (basicly the same as a delegate protocole):

@protocol ObserverProtocol <NSObject>

- (void)somethingDidHappen:(NSString *)message more:(NSInteger)more;

@end

Create an instance of PLObservers with your delegate protocol:

PLObservers <ObserverProtocol> *observers = (PLObservers <ObserverProtocol>*)[[PLObservers alloc] initWithObserverProtocol:@protocol(ObserverProtocol)];

Add/remove as many observers (implementing your PLObservers) as you like:

[observers addObserver:myObserver1]
[observers removeObserver:myObserver2]

Calling a ObserverProtocol method on the PLObservers instance will be forwarded to the registered observers:

[observers somethingDidHappen:@"test" more:123] 

Installation

Author

Antoni Kedracki, [email protected]
Polidea

License

PLObservers is available under the MIT license. See the LICENSE file for more info.