---
title: Observable()
framework: observation
role: symbol
role_heading: Macro
path: observation/observable()
---

# Observable()

Defines and implements conformance of the Observable protocol.

## Declaration

```swift
@attached(member, names: named(_$observationRegistrar), named(access), named(withMutation), named(shouldNotifyObservers)) @attached(memberAttribute) @attached(extension, conformances: Observable) macro Observable()
```

## Mentioned in

Applying Macros

## Overview

Overview This macro adds observation support to a custom type and conforms the type to the Observable protocol. For example, the following code applies the Observable macro to the type Car making it observable: @Observable  class Car {    var name: String = ""    var needsRepairs: Bool = false

init(name: String, needsRepairs: Bool = false) {        self.name = name        self.needsRepairs = needsRepairs    } }

## See Also

### Observable conformance

- [Observable](observation/observable.md)
