Structures

The following structures are available globally.

  • CompactValidatePublisher

    A Combine operator that validates upstream output and sends valid non-nil objects downstream.

    See more

    Declaration

    Swift

    public struct CompactValidatePublisher<Upstream> : Publisher where Upstream : Publisher
  • TryValidationPublisher

    A Combine operator that validates upstream output and sends valid objects or a BasicValidationError downstream.

    See more

    Declaration

    Swift

    public struct TryValidationPublisher<Upstream> : Publisher where Upstream : Publisher, Upstream.Failure == BasicValidationError
  • ValidationPublisher

    A Combine operator that validates upstream output and sends valid objects or nil downstream.

    Usage:

    _ = Just("foo-bar")
       .validate { !.empty && .count(3...) }
       .replaceNil(with: "failed")
       .sink { print($0) }
    
    // "foo-bar"
    
    _ = Just("fo")
       .validate { !.empty && .count(3...) }
       .replaceNil(with: "failed")
       .sink { print($0) }
    
    // "failed"
    
    
    See more

    Declaration

    Swift

    public struct ValidationPublisher<Upstream> : Publisher where Upstream : Publisher