<!--
{
  "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/init(object:keyPath:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine11SubscribersO6AssignC6object7keyPathAEy_xq_Gx_s020ReferenceWritableKeyF0Cyxq_Gtcfc"
  },
  "title" : "init(object:keyPath:)"
}
-->

# init(object:keyPath:)

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

```
init(object: Root, keyPath: ReferenceWritableKeyPath<Root, Input>)
```

## Parameters

`object`

The object that contains the property. The subscriber assigns the object’s property every time it receives a new value.

`keyPath`

A key path that indicates the property to assign. See [Key-Path Expression](https://developer.apple.com/library/archive/documentation/Swift/Conceptual/Swift_Programming_Language/Expressions.html#//apple_ref/doc/uid/TP40014097-CH32-ID563) in *The Swift Programming Language* to learn how to use key paths to specify a property of an object.

---

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)