<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Publisher/first()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAE5firstAA10PublishersO5FirstVy_xGyF"
  },
  "title" : "first()"
}
-->

# first()

Publishes the first element of a stream, then finishes.

```
func first() -> Publishers.First<Self>
```

## Return Value

A publisher that only publishes the first element of a stream.

## Discussion

Use [`first()`](/documentation/Combine/Publisher/first()) to publish just the first element from an upstream publisher, then finish normally. The [`first()`](/documentation/Combine/Publisher/first()) operator requests [`unlimited`](/documentation/Combine/Subscribers/Demand/unlimited) from its upstream as soon as downstream requests at least one element. If the upstream completes before [`first()`](/documentation/Combine/Publisher/first()) receives any elements, it completes without emitting any values.

In this example, the [`first()`](/documentation/Combine/Publisher/first()) publisher republishes the first element received from the sequence publisher, `-10`, then finishes normally.

```
let numbers = (-10...10)
cancellable = numbers.publisher
    .first()
    .sink { print("\($0)") }

// Print: "-10"
```

---

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)