<!--
{
  "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/ObservableObject",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine16ObservableObjectP"
  },
  "title" : "ObservableObject"
}
-->

# ObservableObject

A type of object with a publisher that emits before the object has changed.

```
protocol ObservableObject : AnyObject
```

## Overview

By default an [`ObservableObject`](/documentation/Combine/ObservableObject) synthesizes an [`objectWillChange`](/documentation/Combine/ObservableObject/objectWillChange) publisher that emits the changed value before any of its `@Published` properties changes.

```
class Contact: ObservableObject {
    @Published var name: String
    @Published var age: Int

    init(name: String, age: Int) {
        self.name = name
        self.age = age
    }

    func haveBirthday() -> Int {
        age += 1
        return age
    }
}

let john = Contact(name: "John Appleseed", age: 24)
cancellable = john.objectWillChange
    .sink { _ in
        print("\(john.age) will change")
}
print(john.haveBirthday())
// Prints "24 will change"
// Prints "25"
```

## Topics

### Publishing changes

[`objectWillChange`](/documentation/Combine/ObservableObject/objectWillChange)

A publisher that emits before the object has changed.

[`ObjectWillChangePublisher`](/documentation/Combine/ObservableObject/ObjectWillChangePublisher)

The type of publisher that emits before the object has changed.



---

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)