-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCDRApplicationAssembly.m
45 lines (35 loc) · 1.4 KB
/
CDRApplicationAssembly.m
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
44
45
//
// Created by rizumita on 2013/12/23.
//
#import "CDRApplicationAssembly.h"
#import "CDRCoreDataComponents.h"
#import "CDRDataSource.h"
#import "CDRAppDelegate.h"
#import "CDRViewController.h"
@implementation CDRApplicationAssembly
- (id)config
{
return [TyphoonDefinition configDefinitionWithName:@"Configuration.properties"];
}
- (CDRAppDelegate *)appDelegate
{
return [TyphoonDefinition withClass:[CDRAppDelegate class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(managedObjectContext) with:[self.coreDataAssembly managedObjectContext]];
[definition injectProperty:@selector(managedObjectModel) with:[self.coreDataAssembly managedObjectModel]];
[definition injectProperty:@selector(persistentStoreCoordinator) with:[self.coreDataAssembly persistentStoreCoordinator]];
}];
}
- (CDRViewController *)mainViewController
{
return [TyphoonDefinition withClass:[CDRViewController class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(dataSource) with:[self dataSource]];
}];
}
- (CDRDataSource *)dataSource
{
return [TyphoonDefinition withClass:[CDRDataSource class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(context) with:[self.coreDataAssembly mainManagedObjectContext]];
definition.scope = TyphoonScopeSingleton;
}];
}
@end