Skip to content

Polidea/PLXObservers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLXObservers

CI Status Version License Platform

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

Usage

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

@protocol ObserverProtocol <NSObject>

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

@end

Create an instance of PLXObservers with your delegate protocol:

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

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

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

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

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

Installation

PLXObservers is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "PLXObservers"

Author

Antoni Kedracki, akedracki@gmail.com
Polidea

License

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

About

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

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages