ValueReducer

public protocol ValueReducer

Experimental

The ValueReducer protocol supports ValueObservation.

  • The type of fetched database values

    Declaration

    Swift

    associatedtype Fetched
  • The type of observed values

    Declaration

    Swift

    associatedtype Value
  • Feches database values upon changes in an observed database region.

    Declaration

    Swift

    func fetch(_ db: Database) throws -> Fetched
  • Transforms a fetched value into an eventual observed value. Returns nil when observer should not be notified.

    This method runs inside a private dispatch queue.

    Declaration

    Swift

    mutating func value(_ fetched: Fetched) -> Value?
  • compactMap(_:) Extension method

    Experimental

    Returns a reducer which outputs the non-nil results of calling the given transformation which each element emitted by this reducer.

    Declaration

    Swift

    public func compactMap<T>(_ transform: @escaping (Value) -> T?) -> ValueReducers.CompactMap<Self, T>
  • map(_:) Extension method

    Experimental

    Returns a reducer which outputs the results of calling the given transformation which each element emitted by this reducer.

    Declaration

    Swift

    public func map<T>(_ transform: @escaping (Value) -> T) -> ValueReducers.Map<Self, T>