-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathOrderStore.m
More file actions
43 lines (36 loc) · 827 Bytes
/
OrderStore.m
File metadata and controls
43 lines (36 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// OrderStore.m
// DuDu
//
// Created by i-chou on 1/1/16.
// Copyright © 2016 i-chou. All rights reserved.
//
#import "OrderStore.h"
@implementation OrderStore
+ (instancetype)sharedOrderStore
{
static dispatch_once_t pred = 0;
__strong static id _sharedOrderStore = nil;
dispatch_once(&pred, ^{
_sharedOrderStore = [[self alloc] init];
});
return _sharedOrderStore;
}
- (id)init
{
self = [super init];
if (self) {
_history = [NSMutableArray array];
_ing = [NSMutableArray array];
}
return self;
}
- (void)updateHistoryModel:(OrderModel *)model at:(NSInteger)index
{
[_history setObject:model atIndexedSubscript:index];
}
- (void)updateIngModel:(OrderModel *)model at:(NSInteger)index
{
[_ing setObject:model atIndexedSubscript:index];
}
@end