This repository was archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathCoreComponents.swift
44 lines (33 loc) · 1.56 KB
/
CoreComponents.swift
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
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2013, Typhoon Framework Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
public class CoreComponents: TyphoonAssembly {
public dynamic func weatherClient() -> AnyObject {
return TyphoonDefinition.withClass(WeatherClientBasicImpl.self) {
definition in
definition!.injectProperty("serviceUrl", with:TyphoonConfig("service.url"))
definition!.injectProperty("apiKey", with:TyphoonConfig("api.key"))
definition!.injectProperty("weatherReportDao", with:self.weatherReportDao())
definition!.injectProperty("daysToRetrieve", with:TyphoonConfig("days.to.retrieve"))
} as AnyObject
}
public dynamic func weatherReportDao() -> AnyObject {
return TyphoonDefinition.withClass(WeatherReportDaoFileSystemImpl.self) as AnyObject
}
public dynamic func cityDao() -> AnyObject {
return TyphoonDefinition.withClass(CityDaoUserDefaultsImpl.self) {
definition in
definition!.useInitializer("initWithDefaults:") {
initializer in
initializer!.injectParameter(with: UserDefaults.standard)
}
} as AnyObject
}
}