////Single.h//fkltest////Created by Kun on 16/8/11.//copyright©2016 year Kun. All rights reserved.//#ifndef Single_h#defineSingle_h#defineSINGELH (name) + (instancetype) share# #name;#if__has_feature (OBJC_ARC)//conditional Compilation ARC#defineSingelm (name) static ID share# #name = nil;+ (instancetype) Allocwithzone: (struct_nszone *) zone{Staticdispatch_once_t oncetoken;dispatch_once (&oncetoken, ^{if( !share# #name) {share# #name=[Super Allocwithzone:zone];}});returnshare# #name;}+(instancetype) share# #name {return[[Self alloc] init];}- (ID) Copywithzone: (Nszone *) zone{returnshare# #name;}- (ID) Mutablecopywithzone: (Nszone *) zone{returnshare# #name;}#else //conditional Compilation MRC#defineSingelm (name) static ID share# #name = nil;+ (instancetype) Allocwithzone: (struct_nszone *) zone{Staticdispatch_once_t oncetoken;dispatch_once (&oncetoken, ^{if( !share# #name) {share# #name=[Super Allocwithzone:zone];}});returnshare# #name;}+(instancetype) share# #name {return[[Self alloc] init];}- (ID) Copywithzone: (Nszone *) zone{returnshare# #name;}- (ID) Mutablecopywithzone: (Nszone *) zone{returnshare# #name;}-(OneWayvoid) release{}-(instancetype) retain{returnshared# #name;}-(Nsuinteger) retaincount{returnmaxfloat;}#endif //conditional Compilation#endif/* Single_h */
iOS single-case macro