The Observer
Sensing ripples in the magical weave.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Observer
ARCANUM SCHOOL: Divination // Subschool: Sensing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OBJC PATTERN //
@interface TKCrystalBall : NSObject
- (void)gaze;
@end
@implementation TKCrystalBall
- (instancetype)init {
self = [super init];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(leylineShifted:)
name:@"LeylineShiftedNotification"
object:nil];
}
return self;
}
- (void)leylineShifted:(NSNotification *)note {
NSLog(@"The crystal ball pulses with energy.");
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)gaze {}
@end
Harnessing NSNotificationCenter, the Observer pattern reacts dynamically to systemic ripples, letting objects know when a spell is woven anywhere in the realm.
Runic Tags:
#objc
#observer
#behavioral