I am writing a method for a subclass of NSObject that merges the common NSObject methods “+alloc” and “-init”. This is to save time when creating instances of a class.
(This subclass is also an abstract class. It is like a replacement for subclassing NSObject, so the method must be compatible with subclassing.)
For a method “make”, is this the best way of writing it:
+(id)make
{
id newObject = [[self.class alloc] init];
return newObject;
}
If there is a better way, what would it be?
Thanks
The better way is to just use
+new, which already exists 🙂