美文网首页
OC 单利用法

OC 单利用法

作者: dushuzhong | 来源:发表于2018-11-21 18:36 被阅读9次

    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
    
    

    相关文章

      网友评论

          本文标题:OC 单利用法

          本文链接:https://www.haomeiwen.com/subject/pethqqtx.html