Skip to content

Commit 725f93b

Browse files
committed
Merge branch 'release/1.1.1'
2 parents 14f6fcb + d72d497 commit 725f93b

File tree

7 files changed

+17
-41
lines changed

7 files changed

+17
-41
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55

66
---
77

8+
## [1.1.1](https://github.com/Digipolitan/dependency-injector-swift/releases/tag/v1.1.1)
9+
10+
remove unused methods
11+
add builder pattern
12+
13+
---
14+
815
## [1.1.0](https://github.com/Digipolitan/dependency-injector-swift/releases/tag/v1.1.0)
916

1017
Moving project from dependencies-injector-pure-swift

DGDependencyInjector.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "DGDependencyInjector"
3-
s.version = "1.1.0"
3+
s.version = "1.1.1"
44
s.summary = "Dependency injector made in pure swift"
55
s.homepage = "https://github.com/Digipolitan/dependency-injector-swift"
66
s.license = { :type => "BSD", :file => "LICENSE" }

DGDependencyInjector.xcodeproj/project.pbxproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,22 @@
256256
A3169DCF1DE062A000BABAFD /* Tests */ = {
257257
isa = PBXGroup;
258258
children = (
259-
A37058D61E5DE4ED009D0739 /* Domains */,
259+
A37058D61E5DE4ED009D0739 /* Domain */,
260260
A38EF2C61DECF97000637484 /* DGDependencyInjectorTests */,
261261
A3169DD11DE062A000BABAFD /* Info.plist */,
262262
);
263263
path = Tests;
264264
sourceTree = "<group>";
265265
};
266-
A37058D61E5DE4ED009D0739 /* Domains */ = {
266+
A37058D61E5DE4ED009D0739 /* Domain */ = {
267267
isa = PBXGroup;
268268
children = (
269269
A37058D71E5DE4ED009D0739 /* Cat.swift */,
270270
A37058D81E5DE4ED009D0739 /* Dog.swift */,
271271
A37058D91E5DE4ED009D0739 /* IAnimal.swift */,
272272
A37058DA1E5DE4ED009D0739 /* PetOwner.swift */,
273273
);
274+
name = Domain;
274275
path = Domains;
275276
sourceTree = "<group>";
276277
};

Sources/DependencyInjector.swift

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ open class DependencyInjector {
2323
* @return True on success, otherwise false
2424
*/
2525
@discardableResult
26-
open func register(module: DependencyModule) -> Bool {
26+
open func register(module: DependencyModule) -> Self {
2727
if self.modules.index(of: module) == nil {
2828
self.modules.insert(module, at: 0)
29-
return true
3029
}
31-
return false
30+
return self
3231
}
3332

3433
/**
@@ -51,28 +50,6 @@ open class DependencyInjector {
5150
return self.inject(type: type, scope: nil, arguments: nil)
5251
}
5352

54-
/**
55-
* Creates a new instance conforming the input Type
56-
* The injector search the first module that can provide the injection (The default scope is used)
57-
* @param type The given Type you want to inject
58-
* @param arguments Used by the provider (Such as nonnull parameters for initializers)
59-
* @return An injected object, nil if an error occurred
60-
*/
61-
open func inject<T>(type: T.Type, arguments: [String: Any]?) -> T? {
62-
return self.inject(type: type, scope: nil, arguments: arguments)
63-
}
64-
65-
/**
66-
* Creates a new instance conforming the input Type
67-
* The injector search the first module that can provide the injection
68-
* @param type The given Type you want to inject
69-
* @param scope Custom scope, give nil to use default scope
70-
* @return An injected object, nil if an error occurred
71-
*/
72-
open func inject<T>(type: T.Type, scope: String?) -> T? {
73-
return self.inject(type: type, scope: scope, arguments: nil)
74-
}
75-
7653
/**
7754
* Creates a new instance conforming the input Type
7855
* The injector search the first module that can provide the injection
@@ -81,7 +58,7 @@ open class DependencyInjector {
8158
* @param arguments Used by the provider (Such as nonnull parameters for initializers)
8259
* @return An injected object, nil if an error occurred
8360
*/
84-
open func inject<T>(type: T.Type, scope: String?, arguments: [String: Any]?) -> T? {
61+
open func inject<T>(type: T.Type, scope: String? = nil, arguments: [String: Any]? = nil) -> T? {
8562
for module in self.modules {
8663
if let provider = module.provider(type: type, scope: scope) {
8764
return provider(self, arguments)

Sources/DependencyModule.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,13 @@ open class DependencyModule {
2929
self.records = [:]
3030
}
3131

32-
/**
33-
* Registers a provider for the given Type and for the default scope
34-
* @param type The Type used for injection
35-
* @param provider The provider used to inject an object of Type T
36-
*/
37-
open func register<T>(type: T.Type, provider: @escaping (DependencyInjector, [String: Any]?) -> T?) {
38-
self.register(type: type, scope: nil, provider: provider)
39-
}
40-
4132
/**
4233
* Registers a provider for the given Type
4334
* @param type The Type used for injection
4435
* @param scope The custom scope, give nil to use default scope
4536
* @param provider The provider used to inject an object of Type T
4637
*/
47-
open func register<T>(type: T.Type, scope: String?, provider: @escaping (DependencyInjector, [String: Any]?) -> T?) {
38+
open func register<T>(type: T.Type, scope: String? = nil, provider: @escaping (DependencyInjector, [String: Any]?) -> T?) {
4839
let reference = String(describing: type)
4940
var record = self.records[reference] ?? [:]
5041
record[scope ?? DependencyModule.defaultScope] = provider

Sources/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.1.0</string>
18+
<string>1.1.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
<key>NSPrincipalClass</key>

Tests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0.0</string>
18+
<string>1.1.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
</dict>

0 commit comments

Comments
 (0)