Skip to content

Commit

Permalink
Release 0.3.2 (#18)
Browse files Browse the repository at this point in the history
Includes documentation updates
  • Loading branch information
johnhammerlund authored Dec 23, 2019
1 parent e727f6c commit a069c3b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
- None


## 0.3.2

#### Enhancements
- Add `@Injectable` property wrapper

#### Bug Fixes
- None

#### Other
- None


## 0.3.1

#### Enhancements
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ final class DefaultDependencyRegistry: DependencyRegistryType {
}
/// Recursive dependencies are lazily resolved
DependencyContainer.global.register(MyViewControllerDataStoreType.self) { container in
MyViewControllerDataStore(backendService: container.resolve(MyBackendServiceType.self))
MyViewControllerDataStore(backendService: container.resolve())
}
/// etc.
}
Expand Down Expand Up @@ -134,6 +134,29 @@ final class SampleViewController {

}
```

With Swift 5.1, Relay supports auto-injection via a custom [property wrapper](https://docs.swift.org/swift-book/LanguageGuide/Properties.html#ID617). This allows your interface to be more declarative and for dependency access semantics to be more prescriptive:

```swift
final class MyDependentComponent {

@Injected var foo: FooType
@Injected(scope: .custom) var bar: BarType

}
```

This is equivalent to:

```swift
final class MyDependentComponent {

lazy var foo: FooType = DependencyContainer.global.resolve()
lazy var bar: BarType = DependencyContainer.container(for: .custom).resolve()

}
```

---

## Dynamic Dependencies
Expand Down

0 comments on commit a069c3b

Please sign in to comment.