Skip to content

Commit

Permalink
Stable Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlongco committed Jul 2, 2022
1 parent 93a1aaf commit 80aec2f
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 141 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Factory Changelog

### 1.2.0 - Stable release

* Revised structure to better support ParameterFactory
* Returned to more agressive locking mechanisms
* Revised caching code to eliminate multiple locks
* Changes decorator behavior in favor of a single common decorator for new and cached instances

### 1.1.0

* Adds ParameterFactory to provide type-safe argument passing
Expand Down
5 changes: 1 addition & 4 deletions FactoryDemo/FactoryDemo/FactoryDemoApp+Injection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ extension SharedContainer {
OrderContainer.optionalService.register { SimpleService() }

#if DEBUG
Decorator.cached = {
Decorator.decorate = {
print("FACTORY: \(type(of: $0)) (\(Int(bitPattern: ObjectIdentifier($0 as AnyObject))))")
}
Decorator.created = {
print("FACTORY: \(type(of: $0)) (\(Int(bitPattern: ObjectIdentifier($0 as AnyObject)))) *")
}
#endif
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Failure to find a matching type can lead to an application crash if we attempt t
* **Safe:** Factory is compile-time safe; a factory for a given type *must* exist or the code simply will not compile.
* **Flexible:** It's easy to override dependencies at runtime and for use in SwiftUI Previews.
* **Powerful:** Like Resolver, Factory supports application, cached, shared, and custom scopes, custom containers, arguments, decorators, and more.
* **Lightweight:** With all of that Factory is slim and trim, barely 400 lines of code and half the size of Resolver.
* **Lightweight:** With all of that Factory is slim and trim, well under 400 lines of code and half the size of Resolver.
* **Performant:** Little to no setup time is needed for the vast majority of your services, resolutions are extremely fast, and no compile-time scripts or build phases are needed.
* **Concise:** Defining a registration usually takes just a single line of code. Same for resolution.
* **Tested:** Unit tests ensure correct operation of registrations, resolutions, and scopes.
Expand Down Expand Up @@ -166,7 +166,7 @@ extension Container {
```
Now whenever someone requests an instance of `myService` they'll get the same instance of the object as everyone else.

Unless altered, the default scope is `unique`; every time the factory is asked for an instance of an object it will get a new instance of that object.
If not specified the default scope is `unique`; every time the factory is asked for an instance of an object it will get a new instance of that object.

Other common scopes are `cached` and `shared`. Cached items are persisted until the cache is reset, while shared items exist just as long as someone holds a strong reference to them. When the last reference goes away, the weakly held shared reference also goes away.

Expand Down
Loading

0 comments on commit 80aec2f

Please sign in to comment.