šŸ OBJ-C RUNES DIFFICULTY: Adept Creational

The Builder

Step-by-step construction of complex magical artifacts inside bracketed summoning cages.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Transmutation // Subschool: Artifice
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OBJC PATTERN //
@interface TKArtifact : NSObject
@property (nonatomic, strong) NSString *core;
@property (nonatomic, strong) NSString *enchantment;
@end
@implementation TKArtifact
@end

@interface TKArtifactBuilder : NSObject
@property (nonatomic, strong) TKArtifact *artifact;
- (instancetype)init;
- (void)addCore:(NSString *)core;
- (void)addEnchantment:(NSString *)enchantment;
- (TKArtifact *)build;
@end
@implementation TKArtifactBuilder
- (instancetype)init {
    self = [super init];
    if (self) { _artifact = [[TKArtifact alloc] init]; }
    return self;
}
- (void)addCore:(NSString *)core { self.artifact.core = core; }
- (void)addEnchantment:(NSString *)enchantment { self.artifact.enchantment = enchantment; }
- (TKArtifact *)build { return self.artifact; }
@end

By utilizing Objective-C’s mutable properties, the Builder pattern crafts intricate magical tools step-by-step, caging complexities within a unified interface.

Runic Tags: #objc #builder #creational