---
title: "willSet(_:keyPath:)"
framework: observation
role: symbol
role_heading: Instance Method
path: "observation/observationregistrar/willset(_:keypath:)"
---

# willSet(_:keyPath:)

A property observation called before setting the value of the subject.

## Declaration

```swift
func willSet<Subject, Member>(_ subject: Subject, keyPath: KeyPath<Subject, Member>) where Subject : Observable
```

## Parameters

- `subject`: An instance of an observable type.
- `keyPath`: The key path of an observed property.

## See Also

### Receiving change notifications

- [didSet(_:keyPath:)](observation/observationregistrar/didset(_:keypath:).md)
