| 12345678910111213141516171819202122232425262728293031323334 |
- //
- // Sington.h
- // CWAudioTool
- //
- // Created by chavez on 2017/9/26.
- // Copyright © 2017年 chavez. All rights reserved.
- //
- #define singtonInterface + (instancetype)shareInstance;
- #define singtonImplement(class) \
- \
- static class *_shareInstance; \
- \
- + (instancetype)shareInstance { \
- \
- if(_shareInstance == nil) {\
- _shareInstance = [[class alloc] init]; \
- } \
- return _shareInstance; \
- } \
- \
- +(instancetype)allocWithZone:(struct _NSZone *)zone { \
- \
- static dispatch_once_t onceToken; \
- dispatch_once(&onceToken, ^{ \
- _shareInstance = [super allocWithZone:zone]; \
- }); \
- \
- return _shareInstance; \
- \
- }
|