MimiProcessingParameter

public class MimiProcessingParameter<Value> where Value : Decodable, Value : Encodable, Value : Equatable

Object that represents an individual parameter that can be used to deliver information to Mimi Processing.

  • Result of a value application operation.

    Declaration

    Swift

    @frozen
    public enum ApplicationResult
  • Processing parameter value delivery.

    • continuous: Continuous sends values immediately.
    • discrete: Discrete will wait for the specified time interval (debounce) before sending the value.
    Declaration

    Swift

    @frozen
    public enum DeliveryMode
  • Current value of the parameter.

    Declaration

    Swift

    @Published
    public var value: Value { get set }
  • Create a new applicator for the parameter.

    An applicator represents an individual entity that requires access to the parameter value and future updates. The applicator is registered with the parameter and will receive the chance to asynchronously apply value updates, reporting the result upstream to the parameter.

    Warning

    The returned MimiProcessingParameterApplicator is referenced in a weak manner by the parameter and must be retained manually.

    Declaration

    Swift

    public func applicator() -> MimiProcessingParameterApplicator<Value>
    Return Value

    New applicator.

  • Create a new applicator for the parameter while synchronizing an existing value to the parameter.

    An applicator represents an individual entity that requires access to the parameter value and future updates. The applicator is registered with the parameter and will receive the chance to asynchronously apply value updates, reporting the result upstream to the parameter.

    Additionally this function will synchronize the provided value to the parameter via an internal call to apply().

    Note

    The applicator that is returned is excluded from the apply() call as it is assumed to already have the correct value state.

    Declaration

    Swift

    public func applicator(synchronizing value: Value) -> (MimiProcessingParameterApplicator<Value>, AnyPublisher<Value, Error>)
    Parameters
    value

    Existing value to synchronize to the parameter.

    Return Value

    Tuple containing the newly registered applicator and a Publisher that wraps the application task for applying the synchronized value.

  • Describes the way that parameter values updates are sent to the applicators.

    Declaration

    Swift

    public var deliveryMode: DeliveryMode { get set }
  • Apply a new value to the parameter.

    This will attempt to apply the provided value on all registered applicators that are out of date. For the application to succeed, success must be reported by all applicators that the application is attempted on. If any of the applicators fail to report this, the overall application is considered a failure and will escape.

    Declaration

    Swift

    @discardableResult
    public func apply(_ value: Value) -> AnyPublisher<Value, Error>
    Parameters
    value

    Value to apply.

    Return Value

    Publisher that wraps the application task on applicators that are registered on the parameter.