OC 单利用法
2018-11-21 本文已影响9人
dushuzhong
SCCOrderConfig.h 如下
#import <Foundation/Foundation.h>
@interface SCCOrderConfig : NSObject
+ (instancetype)sharedInstance;
@property (nonatomic, strong) NSDictionary *userInfo;
@property (nonatomic) BOOL isWindmill;
@property (nonatomic, copy) NSString *payerId;
@property (nonatomic, copy) NSString *payerType;
@property (nonatomic) BOOL hasPayAuth;
@end
SCCOrderConfig.m
#import "SCCOrderConfig.h"
@implementation SCCOrderConfig
+ (instancetype)sharedInstance {
static id sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[[self class] alloc] init];
});
return sharedInstance;
}
@end