I have a header for an object that has new marked as unavailable and that is correct (as it should be a singleton)
@interface Manager : NSObject <NSCopying>
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)sharedInstance;
@end
....... now this is correct for the outside but the @implementation of Manager itself should be exempt from this .... I want it to be able to call [self new]
e.g. I want
@implementation Manager
+ (instancetype)shared {
static id shared = nil;
if(!shared) {
shared = [self new];
}
return shared;
}
@end
Please note this is an example and this NOT about singletons. I want to call new even though it is forbidden and above was an example
possible solutions:
- so can I somehow override the unavailability attribute? (preferred)
- is it safe to just call
[super new]