Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlongco committed Sep 30, 2024
1 parent 179d4f6 commit bc49a14
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Factory is strongly influenced by SwiftUI, and in my opinion is highly suited fo
- **Safe**: Factory is compile-time safe; a factory for a given type must exist or the code simply will not compile.
- **Concise**: Defining a registration usually takes just a single line of code. Same for resolution.
- **Flexible**: Working with UIKIt or SwiftUI? iOS or macOS? Using MVVM? MVP? Clean? VIPER? No problem. Factory works with all of these and more.
- **Documented**: Factory 2.0 has extensive DocC documentation and examples covering its classes, methods, and use cases.
- **Lightweight**: With all of that Factory is slim and trim, under 800 lines of executable code.
- **Documented**: Factory has extensive DocC documentation and examples covering its classes, methods, and use cases.
- **Lightweight**: With all of that Factory is slim and trim, under 1,000 lines of executable code.
- **Tested**: Unit tests with 100% code coverage helps ensure correct operation of registrations, resolutions, and scopes.
- **Free**: Factory is free and open source under the MIT License.

Expand Down Expand Up @@ -193,6 +193,31 @@ final class FactoryCoreTests: XCTestCase {
```
Again, Factory makes it easy to reach into a chain of dependencies and make specific changes to the system as needed. This makes testing loading states, empty states, and error conditions simple.

Factory also works with Xcode 16's new Swift Testing framework.

```swift
import Testing

@Suite(.serialized) struct AppTests {
@Test(arguments: Parameters.allCases) func testA(parameter: Parameters) {
// This function will be invoked serially, once per parameter, because the
// containing suite has the .serialized trait.
Container.shared.someService.register { MockService(parameter: parameter) }
let service = Container.shared.someService()
#expect(service.parameter == parameter)
}


@Test func testB() async throws {
// This function will not run while testA(parameter:) is running. One test
// must end before the other will start.
Container.shared.someService.register { ErrorService() }
let service = Container.shared.someService()
#expect(service.error == "Oops")
}
}
```

But we're not done yet.

Factory has quite a few more tricks up its sleeve...
Expand Down Expand Up @@ -302,6 +327,10 @@ If you started with Factory 1.x a [migration document is available here](https:/
* Factory 2.0 adds keyPath-based property wrappers
* Factory 2.0 adds a new InjectedObject property wrapper for SwiftUI Views

## Factory 2.4 Migration

Factory 2.4 works with Xcode 16 under Strict Concurrency guidelines.

## Discussion Forum

Discussion and comments on Factory and Factory 2.0 can be found in [Discussions](https://github.com/hmlongco/Factory/discussions). Go there if you have something to say or if you want to stay up to date.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Factory/Factory/Globals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Foundation
nonisolated(unsafe) internal var globalGraphResolutionDepth = 0

/// Internal key used for Resolver mode
nonisolated(unsafe) internal let globalResolverKey: StaticString = "*"
internal let globalResolverKey: StaticString = "*"

#if DEBUG
/// Internal variables used for debugging
Expand Down

0 comments on commit bc49a14

Please sign in to comment.