The Adapter
Translating arcane tongues into the standard NeXTSTEP protocols.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Subschool: Linguistics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OBJC PATTERN //
@protocol TKModernSpell <NSObject>
- (void)invokeMagic;
@end
@interface TKAncientScroll : NSObject
- (void)chantAncientRunes;
@end
@implementation TKAncientScroll
- (void)chantAncientRunes { NSLog(@"Chanting in dead tongues."); }
@end
@interface TKScrollAdapter : NSObject <TKModernSpell>
@property (nonatomic, strong) TKAncientScroll *scroll;
- (instancetype)initWithScroll:(TKAncientScroll *)scroll;
@end
@implementation TKScrollAdapter
- (instancetype)initWithScroll:(TKAncientScroll *)scroll {
if (self = [super init]) { _scroll = scroll; }
return self;
}
- (void)invokeMagic {
[self.scroll chantAncientRunes];
}
@end
Adapter acts as an arcane translator, adapting the rugged edges of ancient scrolls into the unified messaging interface of modern invocations.
Runic Tags:
#objc
#adapter
#structural