您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页iOS-正确的model创建姿势

iOS-正确的model创建姿势

来源:伴沃教育

#import@interface DYServiceAPIConfig : NSObject

+ (instancetype) shared;

@property (nonatomic, readonly) NSArray *newsInfoArray;

@end

+ (instancetype)shared

{

static DYServiceAPIConfig *_instance = nil;

static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

_instance = [[self alloc] init];

});

return _instance;

}

- (instancetype)init

{

self = [super init];

if (self) {

_newsInfoArray = @[@{ @"topId" : @"",

@"title" : @"头条"},

@{ @"topId" : @"T1461396384709",

@"title" : @"网游"},

@{ @"topId" : @"T1461396358842",

@"title" : @"手游"},

@{ @"topId" : @"T1461396291717",

@"title" : @"主机"},

@{ @"topId" : @"T1461396413033",

@"title" : @"电竞"},

@{ @"topId" : @"T1461396489605",

@"title" : @"暴雪"}];

}

return self;

}

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务