Skip to content

Commit 653db1b

Browse files
authored
Merge branch 'master' into add-language-identifiers
2 parents 69d095e + 99ae25a commit 653db1b

File tree

16 files changed

+289
-135
lines changed

16 files changed

+289
-135
lines changed

CHANGELOG

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Resolver Changelog
22

3+
### 1.4.4
4+
5+
* Reduced code size and improved performance
6+
* Update registration cache key mechanism to prevent possible registration overwrites
7+
8+
### 1.4.3
9+
10+
* Add capability for multiple child containers
11+
12+
### 1.4.2
13+
14+
* Fix threading issue in LazyInjected and WeakLazyInjected property wrappers
15+
* Fix argument passing in .implements
16+
* Update projct for Xcode 12.5
17+
* Update Swift class deprecation
18+
319
### 1.4.1
420

521
* Fix bug forwarding new argument structure from factory to factory - PR#89

Documentation/Containers.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ extension Resolver: ResolverRegistering {
4343
}
4444
```
4545

46-
The static register and resolve functions simply pass the buck to main and root, respectively.
46+
The static (class) register and resolve functions simply pass the buck to main and root, respectively.
4747

4848
```swift
49+
public static func register<Service>(_ type: Service.Type = Service.self, name: Resolver.Name? = nil,
50+
factory: @escaping ResolverFactoryArgumentsN<Service>) -> ResolverOptions<Service> {
51+
return main.register(type, name: name, factory: factory)
52+
}
53+
4954
public static func resolve<Service>(_ type: Service.Type = Service.self, name: String? = nil, args: Any? = nil) -> Service {
5055
return root.resolve(type, name: name, args: args)
5156
}
@@ -172,3 +177,27 @@ Returning, we switch back and the app again behaves normally.
172177

173178
Nice party trick, don't you think?
174179

180+
## Child Containers
181+
182+
Resolver 1.4.3 adds support for multiple child containers.
183+
184+
As stated above, you can put thousands of registrations into a single container but, should you desire to do so, you can now segment your registrations into smaller groups of containiners and then add each subcontainer to the main container.
185+
186+
Consider...
187+
188+
```
189+
extension Resolver {
190+
static let containerA = Resolver()
191+
static let containerB = Resolver()
192+
193+
static func registerAllServices() {
194+
main.add(child: containerA)
195+
main.add(child: containerB)
196+
...
197+
}
198+
}
199+
```
200+
201+
Now when main is asked to resolve a given service, it will first search its own registrations and then, if not found, will search each of the included child containers to see if one of them contains the needed registration. First match will return, and containers will be searched in the order in which they're added.
202+
203+
This is basically a small change that reworks the "parent" mechanism to support multiple children. Parent (or "nested") containers still work as before.

Documentation/Cycle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Note in particular the additional parameters needed to create a `XYZViewModel` a
3333

3434
## The Process
3535

36-
Let's kick things off by given a view controller its view model.
36+
Let's kick things off by giving a view controller its view model.
3737

3838
```swift
3939
class MyViewController: UIViewController {

Documentation/Registration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Introduction
44

5-
As mention in the introduction , in order for Resolve to *resolve* a request for a paticular service you first need to register a factory that knows how to instantiate an instance of the service.
5+
As mentioned in the introduction, in order for Resolve to *resolve* a request for a paticular service you first need to register a factory that knows how to instantiate an instance of the service.
66

77
```swift
88
Resolver.register { NetworkService() }
@@ -28,7 +28,7 @@ Let's start by adding the master injection file for the entire application.
2828
Add a file named `AppDelegate+Injection.swift` to your project and add the following code:
2929

3030
```swift
31-
#import Resolver
31+
import Resolver
3232

3333
extension Resolver: ResolverRegistering {
3434
public static func registerAllServices() {

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ Resolver is available under the MIT license. See the LICENSE file for more info.
127127

128128
## Additional Resouces
129129

130+
* [Resolver for iOS Dependency Injection: Getting Started | Ray Wenderlich](https://www.raywenderlich.com/22203552-resolver-for-ios-dependency-injection-getting-started)
130131
* [API Documentation](./Documentation/API/Classes/Resolver.html)
131132
* [Inversion of Control Design Pattern ~ Wikipedia](https://en.wikipedia.org/wiki/Inversion_of_control)
132133
* [Inversion of Control Containers and the Dependency Injection pattern ~ Martin Fowler](https://martinfowler.com/articles/injection.html)
133-
* [Nuts and Bolts of Dependency Injection in Swift](https://cocoacasts.com/nuts-and-bolts-of-dependency-injection-in-swift/)\
134+
* [Nuts and Bolts of Dependency Injection in Swift](https://cocoacasts.com/nuts-and-bolts-of-dependency-injection-in-swift/)
134135
* [Dependency Injection in Swift](https://cocoacasts.com/dependency-injection-in-swift)
135136
* [SwinjectStoryboard](https://github.com/Swinject/SwinjectStoryboard)
136137
* [Swift 5.1 Takes Dependency Injection to the Next Level](https://medium.com/better-programming/taking-swift-dependency-injection-to-the-next-level-b71114c6a9c6)
137138
* [Builder Demo Application](https://github.com/hmlongco/Builder)
139+

Resolver.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 = "Resolver"
3-
s.version = "1.4.1"
3+
s.version = "1.4.4"
44
s.summary = "An ultralight Dependency Injection / Service Locator framework for Swift on iOS."
55
s.homepage = "https://github.com/hmlongco/Resolver"
66
s.license = "MIT"

Resolver.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,15 @@
234234
isa = PBXProject;
235235
attributes = {
236236
LastSwiftMigration = 9999;
237-
LastUpgradeCheck = 1220;
237+
LastUpgradeCheck = 1250;
238238
};
239239
buildConfigurationList = OBJ_2 /* Build configuration list for PBXProject "Resolver" */;
240240
compatibilityVersion = "Xcode 3.2";
241-
developmentRegion = English;
241+
developmentRegion = en;
242242
hasScannedForEncodings = 0;
243243
knownRegions = (
244-
English,
245244
en,
245+
Base,
246246
);
247247
mainGroup = OBJ_5;
248248
productRefGroup = OBJ_24 /* Products */;

Resolver.xcodeproj/xcshareddata/xcschemes/Resolver-Package.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1220"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Resolver.xcodeproj/xcshareddata/xcschemes/ResolverTests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1220"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

0 commit comments

Comments
 (0)