<!--
{
  "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/map(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAE3mapyAA10PublishersO11MapKeyPath3Vy_xqd__qd_0_qd_1_Gs0F4PathCy6OutputQzqd__G_AKyAMqd_0_GAKyAMqd_1_Gtr1_lF"
  },
  "title" : "map(_:_:_:)"
}
-->

# map(_:_:_:)

Publishes the values of three key paths as a tuple.

```
func map<T0, T1, T2>(_ keyPath0: KeyPath<Self.Output, T0>, _ keyPath1: KeyPath<Self.Output, T1>, _ keyPath2: KeyPath<Self.Output, T2>) -> Publishers.MapKeyPath3<Self, T0, T1, T2>
```

## Parameters

`keyPath0`

The key path of a property on `Output`.

`keyPath1`

The key path of a second property on `Output`.

`keyPath2`

The key path of a third property on `Output`.

## Return Value

A publisher that publishes the values of three key paths as a tuple.

## Discussion

In the following example, the [`map(_:_:_:)`](/documentation/Combine/Publisher/map(_:_:_:)) operator uses the Swift key path syntax to access the `die1`, `die2`, and `die3` members of the `DiceRoll` structure published by the [`Just`](/documentation/Combine/Just) publisher.

The downstream sink subscriber receives only these three values (as an `(Int, Int, Int)` tuple), not the entire `DiceRoll`.

```
struct DiceRoll {
    let die1: Int
    let die2: Int
    let die3: Int
}

cancellable = Just(DiceRoll(die1:Int.random(in:1...6),
                            die2: Int.random(in:1...6),
                            die3: Int.random(in:1...6)))
    .map(\.die1, \.die2, \.die3)
    .sink { values in
        print ("Rolled: \(values.0), \(values.1), \(values.2) (total \(values.0 + values.1 + values.2))")
    }
// Prints "Rolled: 5, 4, 2 (total 11)" (or other random values).
```

---

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)