I want to set the delegate of an object inside a class method in Objective-C. Pseudo-code:
+ (ClassWithDelegate*) myStaticMethod {
if (myObject == nil) {
myObject = [[ClassWithDelegate alloc] init];
// myObject.delegate = ?
}
return myObject;
}
In Java I would simply create an anonymous class that implemented the delegate protocol. How can I do something similar in Objective-C?
Basically I would like to avoid creating a separate class (and files) to implement a simple delegate protocol.