Skip to content

AliasBuilder

maximkrouk edited this page May 5, 2022 · 1 revision

AliasBuilder

A type that is used to configure dependencies aliases when using the DerivedEnvironment property wrapper.

public struct AliasBuilder<Environment> where Environment: GlobalDependenciesAccessing 

Methods

alias(_:to:)

Add a new dependency alias to the builder

public func alias<Dependency>(
    _ dependency: WritableKeyPath<Dependencies, Dependency>,
    to default: WritableKeyPath<Dependencies, Dependency>
  ) -> Self 

You can chain calls to define multiple aliases:

builder
  .alias(\.main, to: \.mainQueue)
  .alias(\.uuid, to: \.idGenerator)
  

See the discussion at DependenciesAccessing.aliasing(:to:) for more information.

Parameters

  • dependency: The KeyPath of the aliased dependency in Dependencies
  • to: A KeyPath of another dependency in Dependencies that serves as a reference value.

alias(_:to:)

Add a new dependency alias to the builder

public func alias<Dependency>(
    _ dependency: WritableKeyPath<Dependencies, Dependency>,
    to default: WritableKeyPath<Dependencies, Dependency>
  ) -> Self 

You can chain calls to define multiple aliases:

builder
  .alias(\.main, to: \.mainQueue)
  .alias(\.uuid, to: \.idGenerator)
  

See the discussion at DependenciesAccessing.aliasing(:to:) for more information.

Parameters

  • dependency: The KeyPath of the aliased dependency in Dependencies
  • to: A KeyPath of another dependency in Dependencies that serves as a reference value.
Clone this wiki locally