2023-09-12 08:17:52 +02:00

35 lines
522 B
Markdown

**PROTOCOL**
# `Observable`
A protocol allowing a class to be observed by a view, window or app.
Views, windows and apps will automatically observe all of its children with an observable type.
```swift
@Observable
class ViewState {
var boolean = false
}
@View
struct TestView {
private let state = ViewState()
var view: Body {
// ...
}
}
```
## Properties
### `didChange`
This function gets called when a property changes.
A view will automatically add a function to this variable.