https://github.com/polidea/plobservers
Small tool for fast implementation of multi-observer pattern in Objective-C
https://github.com/polidea/plobservers
Last synced: 10 months ago
JSON representation
Small tool for fast implementation of multi-observer pattern in Objective-C
- Host: GitHub
- URL: https://github.com/polidea/plobservers
- Owner: Polidea
- License: mit
- Created: 2014-02-17T16:11:57.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-08-03T14:00:01.000Z (almost 10 years ago)
- Last Synced: 2024-10-30T01:10:17.724Z (over 1 year ago)
- Language: Objective-C
- Size: 146 KB
- Stars: 9
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
This library is deprecated in favor of [PLXObservers](https://github.com/Polidea/PLXObservers)
---
# PLObservers
[](http://cocoadocs.org/docsets/PLObservers)
[](http://cocoadocs.org/docsets/PLObservers)
[](http://cocoadocs.org/docsets/PLObservers)
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):
```Objective-C
@protocol ObserverProtocol
- (void)somethingDidHappen:(NSString *)message more:(NSInteger)more;
@end
```
Create an instance of PLObservers with your delegate protocol:
```Objective-C
PLObservers *observers = (PLObservers *)[[PLObservers alloc] initWithObserverProtocol:@protocol(ObserverProtocol)];
```
Add/remove as many observers (implementing your PLObservers) as you like:
```Objective-C
[observers addObserver:myObserver1]
[observers removeObserver:myObserver2]
```
Calling a ObserverProtocol method on the PLObservers instance will be forwarded to the registered observers:
```Objective-C
[observers somethingDidHappen:@"test" more:123]
```
## Installation
PLObservers is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
pod "PLObservers"
## Author
Antoni Kedracki, akedracki@gmail.com
Polidea
## License
PLObservers is available under the MIT license. See the LICENSE file for more info.