<!--
{
  "documentType" : "article",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Just-Publisher-Operators",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Publisher Operators"
}
-->

# Publisher Operators

Methods that create downstream publishers or subscribers to act on the elements they receive.

## Topics

### Mapping elements

[`func map<T>((Output) -> T) -> Just<T>`](/documentation/Combine/Just/map(_:))

[`func tryMap<T>((Output) throws -> T) -> Result<T, any Error>.Publisher`](/documentation/Combine/Just/tryMap(_:))

[`func mapError<E>((Just<Output>.Failure) -> E) -> Result<Output, E>.Publisher`](/documentation/Combine/Just/mapError(_:))

[`func scan<T>(T, (T, Output) -> T) -> Result<T, Just<Output>.Failure>.Publisher`](/documentation/Combine/Just/scan(_:_:))

[`func tryScan<T>(T, (T, Output) throws -> T) -> Result<T, any Error>.Publisher`](/documentation/Combine/Just/tryScan(_:_:))

[`func setFailureType<E>(to: E.Type) -> Result<Output, E>.Publisher`](/documentation/Combine/Just/setFailureType(to:))

### Filtering elements

[`func filter((Output) -> Bool) -> Optional<Output>.Publisher`](/documentation/Combine/Just/filter(_:))

[`func compactMap<T>((Output) -> T?) -> Optional<T>.Publisher`](/documentation/Combine/Just/compactMap(_:))

[`func removeDuplicates() -> Just<Output>`](/documentation/Combine/Just/removeDuplicates())

[`func removeDuplicates(by: (Output, Output) -> Bool) -> Just<Output>`](/documentation/Combine/Just/removeDuplicates(by:))

[`func tryRemoveDuplicates(by: (Output, Output) throws -> Bool) -> Result<Output, any Error>.Publisher`](/documentation/Combine/Just/tryRemoveDuplicates(by:))

[`func replaceEmpty(with: Output) -> Just<Output>`](/documentation/Combine/Just/replaceEmpty(with:))

[`func replaceError(with: Output) -> Just<Output>`](/documentation/Combine/Just/replaceError(with:))

### Reducing elements

[`func collect() -> Just<[Output]>`](/documentation/Combine/Just/collect())

[`func ignoreOutput() -> Empty<Output, Just<Output>.Failure>`](/documentation/Combine/Just/ignoreOutput())

[`func reduce<T>(T, (T, Output) -> T) -> Result<T, Just<Output>.Failure>.Publisher`](/documentation/Combine/Just/reduce(_:_:))

[`func tryReduce<T>(T, (T, Output) throws -> T) -> Result<T, any Error>.Publisher`](/documentation/Combine/Just/tryReduce(_:_:))

### Applying mathematical operations on elements

[`func count() -> Just<Int>`](/documentation/Combine/Just/count())

[`func max() -> Just<Output>`](/documentation/Combine/Just/max())

[`func max(by: (Output, Output) -> Bool) -> Just<Output>`](/documentation/Combine/Just/max(by:))

[`func min() -> Just<Output>`](/documentation/Combine/Just/min())

[`func min(by: (Output, Output) -> Bool) -> Just<Output>`](/documentation/Combine/Just/min(by:))

### Applying matching criteria to elements

[`func contains(Output) -> Just<Bool>`](/documentation/Combine/Just/contains(_:))

[`func contains(where: (Output) -> Bool) -> Just<Bool>`](/documentation/Combine/Just/contains(where:))

[`func tryContains(where: (Output) throws -> Bool) -> Result<Bool, any Error>.Publisher`](/documentation/Combine/Just/tryContains(where:))

[`func allSatisfy((Output) -> Bool) -> Just<Bool>`](/documentation/Combine/Just/allSatisfy(_:))

[`func tryAllSatisfy((Output) throws -> Bool) -> Result<Bool, any Error>.Publisher`](/documentation/Combine/Just/tryAllSatisfy(_:))

### Applying sequence operations to elements

[`func dropFirst(Int) -> Optional<Output>.Publisher`](/documentation/Combine/Just/dropFirst(_:))

[`func drop(while: (Output) -> Bool) -> Optional<Output>.Publisher`](/documentation/Combine/Just/drop(while:))

[`func append(Output...) -> Publishers.Sequence<[Output], Just<Output>.Failure>`](/documentation/Combine/Just/append(_:)-7eyqj)

[`func append<S>(S) -> Publishers.Sequence<[Output], Just<Output>.Failure>`](/documentation/Combine/Just/append(_:)-7sxlu)

[`func prepend<S>(S) -> Publishers.Sequence<[Output], Just<Output>.Failure>`](/documentation/Combine/Just/prepend(_:)-39e57)

[`func prepend(Output...) -> Publishers.Sequence<[Output], Just<Output>.Failure>`](/documentation/Combine/Just/prepend(_:)-7fg73)

[`func prefix(Int) -> Optional<Output>.Publisher`](/documentation/Combine/Just/prefix(_:))

[`func prefix(while: (Output) -> Bool) -> Optional<Output>.Publisher`](/documentation/Combine/Just/prefix(while:))

### Selecting specific elements

[`func first() -> Just<Output>`](/documentation/Combine/Just/first())

[`func first(where: (Output) -> Bool) -> Optional<Output>.Publisher`](/documentation/Combine/Just/first(where:))

[`func last() -> Just<Output>`](/documentation/Combine/Just/last())

[`func last(where: (Output) -> Bool) -> Optional<Output>.Publisher`](/documentation/Combine/Just/last(where:))

[`func output(at: Int) -> Optional<Output>.Publisher`](/documentation/Combine/Just/output(at:))

[`func output<R>(in: R) -> Optional<Output>.Publisher`](/documentation/Combine/Just/output(in:))

### Handling errors

[`func retry(Int) -> Just<Output>`](/documentation/Combine/Just/retry(_:))



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)