#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface H5Container : NSObject
+ (instancetype)sharedInstance;
- (instancetype)init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
#import "H5Container.h"
@interface H5Container ()
@end
@implementation H5Container
+ (instancetype)sharedInstance {
static H5Container *manager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager = [[super allocWithZone:NULL] _init];
});
return manager;
}
- (instancetype)_init {
return [super init];
}
+ (id)allocWithZone:(struct _NSZone *)zone {
return [self sharedInstance];
}
- (id)copyWithZone:(nullable NSZone*)zone {
return self;
}
@end
网友评论