Skip to content

LoadableForEachEnvironment

m-housh edited this page Aug 20, 2021 · 1 revision

LoadableForEachEnvironment

Represents the environment for a LoadableForEach view.

public struct LoadableForEachEnvironment<Element, Id: Hashable, LoadRequest, Failure: Error> 

Initializers

init(load:mainQueue:)

Create a new environment.

public init(
    load: @escaping (LoadRequest) -> Effect<IdentifiedArray<Id, Element>, Failure>,
    mainQueue: AnySchedulerOf<DispatchQueue>
  ) 

Parameters

  • load: Load the elements.
  • mainQueue: The main dispatch queue.

init(id:environment:)

Wraps a LoadableListEnvironment and returns an IdentifiedArray to be used in for each stores.

public init(
    id: KeyPath<Element, Id>,
    environment listEnvironment: LoadableListEnvironment<Element, LoadRequest, Failure>
  ) 

Parameters

  • id: The key path to the id of the element.
  • listEnvironment: The list environment to derive our load method from.

init(environment:)

Wraps a LoadableListEnvironment and returns an IdentifiedArray to be used in for each stores, when the element is Identifiable.

public init(
    environment listEnvironment: LoadableListEnvironment<Element, LoadRequest, Failure>
  ) where Element: Identifiable, Id == Element.ID 

Parameters

  • listEnvironment: The list environment to derive our load method from.

init(environment:)

Wraps a LoadableEnvironmentRepresentable in a LoadableForEachEnvironment.

public init<Environment: LoadableEnvironmentRepresentable>(
    environment loadableEnvironment: Environment
  )
  where
    Environment.LoadedValue == IdentifiedArray<Id, Element>,
    Environment.Failure == Failure,
    Environment.LoadRequest == LoadRequest

Parameters

  • loadableEnvironment: The loadable environment to transform to a for each environment.

Properties

load

Load the elements.

public var load: (LoadRequest) -> Effect<IdentifiedArray<Id, Element>, Failure>

mainQueue

The main dispatch queue.

public var mainQueue: AnySchedulerOf<DispatchQueue>

failing

DEBUG

A concrete LoadableForEachEnvironment that fails.

public static var failing: Self 

noop

A concrete LoadableForEachEnvironment that does nothing.

public static var noop: Self 
Clone this wiki locally