---
title: "init(object:keyPath:)"
framework: combine
role: symbol
role_heading: Initializer
path: "combine/subscribers/assign/init(object:keypath:)"
---

# init(object:keyPath:)

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

## Declaration

```swift
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 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.
