<!--
{
  "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/Subscribers/Assign",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine11SubscribersO6AssignC"
  },
  "title" : "Subscribers.Assign"
}
-->

# Subscribers.Assign

A simple subscriber that assigns received elements to a property indicated by a key path.

```
final class Assign<Root, Input>
```

## Topics

### Creating an assign subscriber

[`init(object:keyPath:)`](/documentation/Combine/Subscribers/Assign/init(object:keyPath:))

Creates a subscriber to assign the value of a property indicated by a key path.

### Receiving elements

[`receive(_:)`](/documentation/Combine/Subscribers/Assign/receive(_:))

Tells the subscriber that the publisher has produced an element.

### Receiving life cycle events

[`receive(subscription:)`](/documentation/Combine/Subscribers/Assign/receive(subscription:))

Tells the subscriber that it has successfully subscribed to the publisher and may request items.

[`receive(completion:)`](/documentation/Combine/Subscribers/Assign/receive(completion:))

Tells the subscriber that the publisher has completed publishing, either normally or with an error.

### Inspecting the assigned property

[`object`](/documentation/Combine/Subscribers/Assign/object)

The object that contains the property to assign.

[`keyPath`](/documentation/Combine/Subscribers/Assign/keyPath)

The key path that indicates the property to assign.

### Supporting Debugging

[`customMirror`](/documentation/Combine/Subscribers/Assign/customMirror)

A mirror that reflects the subscriber.

[`description`](/documentation/Combine/Subscribers/Assign/description)

A textual representation of this subscriber.

[`playgroundDescription`](/documentation/Combine/Subscribers/Assign/playgroundDescription)

A custom playground description for this subscriber.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Cancellable`](/documentation/Combine/Cancellable)

[`CustomReflectable`](/documentation/Swift/CustomReflectable)

[`Subscriber`](/documentation/Combine/Subscriber)

[`CustomCombineIdentifierConvertible`](/documentation/Combine/CustomCombineIdentifierConvertible)

[`CustomPlaygroundDisplayConvertible`](/documentation/Swift/CustomPlaygroundDisplayConvertible)

---

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)