# \#observation

**URL:** https://forums.swift.org/tag/observation/802.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [\[Pitch\] Observation performance and modeling improvements](https://forums.swift.org/t/pitch-observation-performance-and-modeling-improvements/89924)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 16\
**Last updated:** [October 22, 2026, 2:53pm UTC](https://forums.swift.org/t/pitch-observation-performance-and-modeling-improvements/89924 "2026-10-22T14:53:47Z")

</div>

Observation is now the model layer of most new SwiftUI code, and it is increasingly used outside SwiftUI: in middleware, in synchronization between models, and on constrained targets. That breadth exposes costs and gap…

---

## [Stale view update in \`willSet\` (Observation & SwiftUI)?](https://forums.swift.org/t/stale-view-update-in-willset-observation-swiftui/90131)

<div class="topic-metadata">

**Author:** [@oscbyspro](https://forums.swift.org/u/oscbyspro)\
**Replies:** 0\
**Last updated:** [October 18, 2026, 6:36am UTC](https://forums.swift.org/t/stale-view-update-in-willset-observation-swiftui/90131 "2026-10-18T06:36:12Z")

</div>

I have encountered a synchronization issue while developing my iOS app where two parts of a SwiftUI view graph disagree on the same @MainActor @Observable view model state. Imagine two views that access currentValue in t…

---

## [Publishable - synchronous observation of Observable changes through Combine](https://forums.swift.org/t/publishable-synchronous-observation-of-observable-changes-through-combine/79924)

<div class="topic-metadata">

**Author:** [@NSFatalError](https://forums.swift.org/u/NSFatalError)\
**Replies:** 3\
**Last updated:** [September 6, 2026, 2:41pm UTC](https://forums.swift.org/t/publishable-synchronous-observation-of-observable-changes-through-combine/79924 "2026-09-06T14:41:25Z")

</div>

I'm excited to share with you the second package I'm releasing this week - Publishable Excerpts from README: What Problem Publishable Solves? With the introduction of SE-0475: Transactional Observation of Values, Swif…

---

## [Observation optimizes away unnecessary callbacks for Equatable properties… sometimes](https://forums.swift.org/t/observation-optimizes-away-unnecessary-callbacks-for-equatable-properties-sometimes/89358)

<div class="topic-metadata">

**Author:** [@marco.masser](https://forums.swift.org/u/marco.masser)\
**Replies:** 5\
**Last updated:** [September 4, 2026, 2:45pm UTC](https://forums.swift.org/t/observation-optimizes-away-unnecessary-callbacks-for-equatable-properties-sometimes/89358 "2026-09-04T14:45:09Z")

</div>

It seems like changing a property in an @Observable class triggers observation callbacks, but that is optimized away the value does not actually change and it is of an Equatable type. This makes a lot of sense and is a n…

---

## [Gotcha when using ObservationTracking.Event.matches](https://forums.swift.org/t/gotcha-when-using-observationtracking-event-matches/87741)

<div class="topic-metadata">

**Author:** [@mbrandonw](https://forums.swift.org/u/mbrandonw)\
**Replies:** 4\
**Last updated:** [July 9, 2026, 12:36am UTC](https://forums.swift.org/t/gotcha-when-using-observationtracking-event-matches/87741 "2026-07-09T00:36:10Z")

</div>

Looking through some WWDC26 sample code I came across something that was difficult to understand: activity.token = withContinuousObservation(options: .didSet) { event in \_ = activity.name \_ = activity.isComplete …

---

## [@State usage in combination with injecting @Observable models into SwiftUI views](https://forums.swift.org/t/state-usage-in-combination-with-injecting-observable-models-into-swiftui-views/84621)

<div class="topic-metadata">

**Author:** [@finebel](https://forums.swift.org/u/finebel)\
**Replies:** 0\
**Last updated:** [February 8, 2026, 10:21am UTC](https://forums.swift.org/t/state-usage-in-combination-with-injecting-observable-models-into-swiftui-views/84621 "2026-02-08T10:21:52Z")

</div>

I have some questions related to the @State property wrapper and how it can/should be used in combination with injecting a @Observable model into the view. My understanding is as follows: Generally speaking, @State s…

---

## [removeAll is triggering an observation even though array is unchanged](https://forums.swift.org/t/removeall-is-triggering-an-observation-even-though-array-is-unchanged/84267)

<div class="topic-metadata">

**Author:** [@Venkata-Maniteja](https://forums.swift.org/u/Venkata-Maniteja)\
**Replies:** 2\
**Last updated:** [January 21, 2026, 3:36pm UTC](https://forums.swift.org/t/removeall-is-triggering-an-observation-even-though-array-is-unchanged/84267 "2026-01-21T15:36:08Z")

</div>

Recently I have noticed an interesting thing when using the Observable annotation. I have a model marked with Observable, and there is an array in the model, at some point I call the removeAll on this array using a where …

---

## [@dynamicMemberLookup + nested KeyPath access not triggering my custom observation access tracking](https://forums.swift.org/t/dynamicmemberlookup-nested-keypath-access-not-triggering-my-custom-observation-access-tracking/84165)

<div class="topic-metadata">

**Author:** [@Blacksmith](https://forums.swift.org/u/Blacksmith)\
**Replies:** 1\
**Last updated:** [January 15, 2026, 8:44pm UTC](https://forums.swift.org/t/dynamicmemberlookup-nested-keypath-access-not-triggering-my-custom-observation-access-tracking/84165 "2026-01-15T20:44:12Z")

</div>

Hello everyone, I’m experimenting with a custom observation mechanism for value-type State (similar in spirit to @Observable, but without macros). While doing that, I ran into an unexpected behavior involving @dynamicMe…

---

## [\[Pitch\] Advanced Observation Tracking](https://forums.swift.org/t/pitch-advanced-observation-tracking/83521)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 21\
**Last updated:** [January 12, 2026, 11:09pm UTC](https://forums.swift.org/t/pitch-advanced-observation-tracking/83521 "2026-01-12T23:09:34Z")

</div>

Introduction Observation has one primary public entry point for observing the changes to @Observable types. This proposal adds two new versions that allow more fine-grained control and advanced behaviors. In particular, …

---

## [How to use Observation to actually observe changes to a property](https://forums.swift.org/t/how-to-use-observation-to-actually-observe-changes-to-a-property/67591)

<div class="topic-metadata">

**Author:** [@pgorzelany](https://forums.swift.org/u/pgorzelany)\
**Replies:** 24\
**Last updated:** [December 4, 2025, 7:50pm UTC](https://forums.swift.org/t/how-to-use-observation-to-actually-observe-changes-to-a-property/67591 "2025-12-04T19:50:54Z")

</div>

First off all I would like to thank the team for implementing the Observation framework. I really like the premise of it: Observation provides a robust, type-safe, and performant implementation of the observer design p…

---

## ['withObservationTracking' firing onChange even if value doesn't change](https://forums.swift.org/t/withobservationtracking-firing-onchange-even-if-value-doesnt-change/71171)

<div class="topic-metadata">

**Author:** [@softwarehangar7](https://forums.swift.org/u/softwarehangar7)\
**Replies:** 4\
**Last updated:** [October 29, 2025, 9:46am UTC](https://forums.swift.org/t/withobservationtracking-firing-onchange-even-if-value-doesnt-change/71171 "2025-10-29T09:46:01Z")

</div>

I did a small experiment with the following code: @Observable class State { var value = 0 var isSomething = false } and var state = State() func printOnChange() { withObservationTracking { print("…

---

## [How to reliably await a change to an Observable type in tests](https://forums.swift.org/t/how-to-reliably-await-a-change-to-an-observable-type-in-tests/82636)

<div class="topic-metadata">

**Author:** [@prachi](https://forums.swift.org/u/prachi)\
**Replies:** 6\
**Last updated:** [October 14, 2025, 5:06pm UTC](https://forums.swift.org/t/how-to-reliably-await-a-change-to-an-observable-type-in-tests/82636 "2025-10-14T17:06:28Z")

</div>

Hi there, I have a Stub type that records its parameters and return value whenever it is called. It stores these in a calls array, and has computed properties for accessing the callArguments, among other things. I also…

---

## [@Observable With Locks](https://forums.swift.org/t/observable-with-locks/82380)

<div class="topic-metadata">

**Author:** [@FiggChristian](https://forums.swift.org/u/FiggChristian)\
**Replies:** 4\
**Last updated:** [September 27, 2025, 6:53am UTC](https://forums.swift.org/t/observable-with-locks/82380 "2025-09-27T06:53:11Z")

</div>

How is @Observable intended to interact with mutable state protected by a lock? Consider a class like: final class Counter: Sendable { private let \_value = Mutex(0) var value: Int { \_value.withLock { $0 } } …

---

## [Pitch: Conditional Property Setters with set(when:)](https://forums.swift.org/t/pitch-conditional-property-setters-with-set-when/82342)

<div class="topic-metadata">

**Author:** [@sdmarcotte](https://forums.swift.org/u/sdmarcotte)\
**Replies:** 0\
**Last updated:** [September 24, 2025, 7:02pm UTC](https://forums.swift.org/t/pitch-conditional-property-setters-with-set-when/82342 "2025-09-24T19:02:47Z")

</div>

Pitch: Conditional Property Setters with set(when:) Problem Swift's property observers (willSet/didSet) are called on every assignment, even when the assigned value is identical to the current value. This creates unneces…

---

## [Observations { } for await - Compilation Error](https://forums.swift.org/t/observations-for-await-compilation-error/80508)

<div class="topic-metadata">

**Author:** [@somu](https://forums.swift.org/u/somu)\
**Replies:** 8\
**Last updated:** [July 23, 2025, 8:31am UTC](https://forums.swift.org/t/observations-for-await-compilation-error/80508 "2025-07-23T08:31:15Z")

</div>

Hi, I was watching the video WWDC25: What's new in Swift Compilation Error When I tried to compile code I got the following compilation error" Cannot find 'Observations' in scope Configuration Xcode: 26 macOS: 15.5 …

---

## [An Observable class held by a SwiftUI View is not deinitialized](https://forums.swift.org/t/an-observable-class-held-by-a-swiftui-view-is-not-deinitialized/79505)

<div class="topic-metadata">

**Author:** [@taji-taji](https://forums.swift.org/u/taji-taji)\
**Replies:** 2\
**Last updated:** [April 27, 2025, 11:02am UTC](https://forums.swift.org/t/an-observable-class-held-by-a-swiftui-view-is-not-deinitialized/79505 "2025-04-27T11:02:53Z")

</div>

I'm using the new Observation framework to separate the state of a SwiftUI View into an observable class, which the view holds onto. However, in some cases, even after the view's lifecycle ends, the observable class is …

---

## [\[Pitch\] Transactional observation of values](https://forums.swift.org/t/pitch-transactional-observation-of-values/78315)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 96\
**Last updated:** [April 15, 2025, 6:46pm UTC](https://forums.swift.org/t/pitch-transactional-observation-of-values/78315 "2025-04-15T18:46:51Z")

</div>

After much anticipation and a lot of footwork, I am really excited to present something I have been working on for a bit now. A transactional observation mechanism to provide an AsyncSequence from approachable compositio…

---

## [Hiding observable variables behind a read- and consume-only protocol](https://forums.swift.org/t/hiding-observable-variables-behind-a-read-and-consume-only-protocol/78650)

<div class="topic-metadata">

**Author:** [@LucasVanDongen](https://forums.swift.org/u/LucasVanDongen)\
**Replies:** 1\
**Last updated:** [March 19, 2025, 8:11pm UTC](https://forums.swift.org/t/hiding-observable-variables-behind-a-read-and-consume-only-protocol/78650 "2025-03-19T20:11:07Z")

</div>

Since the introduction of Combine, and continuing into the I've never found a way to hide a value I want to observe behind a protocol, without introducing at least one of the following problems: It's no longer observa…

---

## [Accessing @Observable property in init changes behavior](https://forums.swift.org/t/accessing-observable-property-in-init-changes-behavior/78542)

<div class="topic-metadata">

**Author:** [@pwoessner](https://forums.swift.org/u/pwoessner)\
**Replies:** 6\
**Last updated:** [March 16, 2025, 8:26am UTC](https://forums.swift.org/t/accessing-observable-property-in-init-changes-behavior/78542 "2025-03-16T08:26:53Z")

</div>

Hi all, I am currently exploring the Observation framework and possible integrations with a MVVM architecture (I am aware of the overall discussion on SwiftUI and MVVM and if it is desired to have ViewModels at all, but…

---

## [ObservationRegistar: Is willSet/didSet Reentrant?](https://forums.swift.org/t/observationregistar-is-willset-didset-reentrant/78236)

<div class="topic-metadata">

**Author:** [@bdkjones](https://forums.swift.org/u/bdkjones)\
**Replies:** 0\
**Last updated:** [March 3, 2025, 6:50am UTC](https://forums.swift.org/t/observationregistar-is-willset-didset-reentrant/78236 "2025-03-03T06:50:45Z")

</div>

For ObservationRegistrar, are the willSet and didSet methods safely reentrant? If the answer is, "Yes, technically," is the followup something like, "But you're going to have a really bad time performance-wise, especial…

---

## [Observation's @State init multiple times](https://forums.swift.org/t/observations-state-init-multiple-times/77739)

<div class="topic-metadata">

**Author:** [@DenisRybkin](https://forums.swift.org/u/DenisRybkin)\
**Replies:** 2\
**Last updated:** [February 9, 2025, 9:32pm UTC](https://forums.swift.org/t/observations-state-init-multiple-times/77739 "2025-02-09T21:32:26Z")

</div>

Here’s a minimal code sample that reproduces the bug. @main struct ObservationApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { @Stat…

---

## [Two approaches to observe @Observable object without/outside View](https://forums.swift.org/t/two-approaches-to-observe-observable-object-without-outside-view/77004)

<div class="topic-metadata">

**Author:** [@qf0421](https://forums.swift.org/u/qf0421)\
**Replies:** 8\
**Last updated:** [January 23, 2025, 11:52am UTC](https://forums.swift.org/t/two-approaches-to-observe-observable-object-without-outside-view/77004 "2025-01-23T11:52:57Z")

</div>

Hi all, I'm trying to refactor my ObservableObject with publishers to @Observable objects. Currently I actually use combine to observe between these ObservableObjects for some states usage. But I can't do so in @Observ…

---

## [@Observable init() called multiple times by @State, different behavior to @StateObject](https://forums.swift.org/t/observable-init-called-multiple-times-by-state-different-behavior-to-stateobject/70811)

<div class="topic-metadata">

**Author:** [@paxos](https://forums.swift.org/u/paxos)\
**Replies:** 11\
**Last updated:** [November 14, 2024, 9:38pm UTC](https://forums.swift.org/t/observable-init-called-multiple-times-by-state-different-behavior-to-stateobject/70811 "2024-11-14T21:38:32Z")

</div>

:wave: I am trying to adapt @Observation in my app, but some behavioral differences confuse me. Here is a minimal code example: Codeclass MyModelClassic: ObservableObject { @Published var someData: String init…

---

## [Tracking properties in \`@Observable\` models internally](https://forums.swift.org/t/tracking-properties-in-observable-models-internally/66743)

<div class="topic-metadata">

**Author:** [@prathameshk](https://forums.swift.org/u/prathameshk)\
**Replies:** 15\
**Last updated:** [October 28, 2024, 10:02pm UTC](https://forums.swift.org/t/tracking-properties-in-observable-models-internally/66743 "2024-10-28T22:02:24Z")

</div>

I have a view model type @Observable model object that reads inputs and processes them into outputs. With @ObservedObject and @Published wrappers it was straightforward to setup the pipelines using publishers. Now that I…

---

## [\[Pitch\] Observation (Revised)](https://forums.swift.org/t/pitch-observation-revised/63757)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 117\
**Last updated:** [October 10, 2024, 5:08pm UTC](https://forums.swift.org/t/pitch-observation-revised/63757 "2024-10-10T17:08:29Z")

</div>

Observation Proposal: SE-NNNN Authors: Philippe Hausler, Nate Cook Review Manager: TBD Status: Awaiting implementation Changes Pitch 1: Initial pitch Pitch 2: Previously Observation registered observers directly to Ob…

---

## [Using Observation in a Protocol throws compiler error](https://forums.swift.org/t/using-observation-in-a-protocol-throws-compiler-error/69090)

<div class="topic-metadata">

**Author:** [@TS200010](https://forums.swift.org/u/TS200010)\
**Replies:** 6\
**Last updated:** [September 10, 2024, 6:03pm UTC](https://forums.swift.org/t/using-observation-in-a-protocol-throws-compiler-error/69090 "2024-09-10T18:03:19Z")

</div>

I have boiled down a problem from a large project to the following fragment that generates a compiler error as shown. It seems to me that in XYGrid, v is of type T which is known to conform to P and hence be Observable.…

---

## [Evidence for Performance Benefits of the Observation](https://forums.swift.org/t/evidence-for-performance-benefits-of-the-observation/74398)

<div class="topic-metadata">

**Author:** [@JunHyuk\_Park](https://forums.swift.org/u/JunHyuk_Park)\
**Replies:** 0\
**Last updated:** [September 5, 2024, 6:40pm UTC](https://forums.swift.org/t/evidence-for-performance-benefits-of-the-observation/74398 "2024-09-05T18:40:16Z")

</div>

Hi! I've been exploring the new Observation framework and its potential advantages over ObservableObject. While the documentation suggests that Observation provides a more efficient way to make app model data observable…

---

## [How to avoid Concurrency Error of capturing a MainActor-isolated closure in a Sendable closure](https://forums.swift.org/t/how-to-avoid-concurrency-error-of-capturing-a-mainactor-isolated-closure-in-a-sendable-closure/74123)

<div class="topic-metadata">

**Author:** [@Fritzt](https://forums.swift.org/u/Fritzt)\
**Replies:** 5\
**Last updated:** [August 28, 2024, 2:12pm UTC](https://forums.swift.org/t/how-to-avoid-concurrency-error-of-capturing-a-mainactor-isolated-closure-in-a-sendable-closure/74123 "2024-08-28T14:12:27Z")

</div>

I spent quite a bit of time trying to figure out how to avoid the following Swift 6 error in the function below (which aims to receive an AsyncStream of property value changes) but failed so far: Capture of 'observe()' …

---

## [Unable to manually attach ObservationTracked. Is this intended behavior?](https://forums.swift.org/t/unable-to-manually-attach-observationtracked-is-this-intended-behavior/70812)

<div class="topic-metadata">

**Author:** [@vanvoorden](https://forums.swift.org/u/vanvoorden)\
**Replies:** 7\
**Last updated:** [August 7, 2024, 1:28pm UTC](https://forums.swift.org/t/unable-to-manually-attach-observationtracked-is-this-intended-behavior/70812 "2024-08-07T13:28:44Z")

</div>

Hi! I'm currently (5.10 and 5.11) unable to manually attach an ObservationTracked macro to an Observable class: import Observation @available(macOS 14.0, \*) @available(iOS 17.0, \*) @Observable class Person { @Observa…

---

## [Is it possible to use new Observation Framework with UIKit?](https://forums.swift.org/t/is-it-possible-to-use-new-observation-framework-with-uikit/65780)

<div class="topic-metadata">

**Author:** [@ibrahimcetin](https://forums.swift.org/u/ibrahimcetin)\
**Replies:** 5\
**Last updated:** [July 27, 2024, 9:38am UTC](https://forums.swift.org/t/is-it-possible-to-use-new-observation-framework-with-uikit/65780 "2024-07-27T09:38:59Z")

</div>

Apple released their new Observation Framework in WWDC23 and they use it with SwiftUI. I've seen lots of resources about how to use it with SwiftUI but I cannot find anything how can I use it with UIKit. So, I am curious…

[Next page](https://forums.swift.org/tag/observation/802.md?match_all_tags=true&page=1&tags%5B%5D=observation)
