Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikGrodl committed Aug 15, 2024
1 parent 97324f5 commit bfc4457
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Sources/DependenciesMacros/Macros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,30 @@ public macro DependencyEndpoint(method: String = "") =
public macro DependencyEndpointIgnored() =
#externalMacro(module: "DependenciesMacrosPlugin", type: "DependencyEndpointIgnoredMacro")

/// Enables shorthand syntax for registering dependencies to DependencyValues
///
/// Now you can use simple syntax anywhere you would normally register a dependency:
///
///```swift
/// extension DependencyValues {
/// @DependencyEntry var myDependency: MyDependency
/// }
/// ```
///
/// which in turn expands to:
///
/// ```swift
/// extension DependencyValues {
/// @DependencyEntry var myDependency: MyDependency {
/// get {
/// self[MyDependency.self]
/// }
/// set {
/// self[MyDependency.self] = newValue
/// }
/// }
/// }
/// ```
@attached(accessor, names: named(get), named(set))
public macro DependencyEntry() = #externalMacro(
module: "DependenciesMacrosPlugin",
Expand Down

0 comments on commit bfc4457

Please sign in to comment.