#observableobject
SwiftのObservationフレームワークを、Observableマクロの展開後のコードから解説しました🔍
依存追跡のタイミング、ObservationIgnoredの使い方、ObservableObjectからの移行表まで。
注意したいのは、配列の要素の変更が追跡されないなどの落とし穴です。
移行、もう済みましたか?
ai-pick.jp/64566/
September 29, 2026 at 12:08 AM
@ Observable tracks reads per view. A view is invalidated only by the properties it read in its last body pass.

ObservableObject publishes at the object level, so every observing view redraws, whatever changed.

Reading a property for a debug print now subscribes you to it.

#iosdev #swiftui
September 9, 2026 at 5:49 PM
📆 What's your favorite #swiftlang or #appledev article or blog post you read this week? 📚

For me it's probably this one by @polpielladev.bsky.social about listening to property changes in `@Observable` classes with AsyncStream and willSet instead of Combine
www.polpiella.dev/observable-p...
#iosdev
How to listen for property changes in an @Observable class using AsyncStreams
A comparison between ObservableObject and the new Observable macro and how to listen and react to property changes in both.
www.polpiella.dev
November 29, 2024 at 8:59 PM
📢 Announcing ObservableConverter, a handy new SwiftPM plugin to convert your SwiftUI code from ObservableObject to the new @Observable macro introduced at #WWDC23.

⬇️ Find out how it works and how to use it for your own app in our latest post!

lickability.com/blog/introdu...
Introducing ObservableConverter
At WWDC 2023, Apple introduced the brand new @Observable macro, a simple way to define a type with properties that will automatically update SwiftUI views when they change, replacing the ObservableObj...
lickability.com
August 22, 2023 at 7:55 PM
i still use ObservableObject instead of @Observable
February 16, 2026 at 5:12 PM
The selected values are stored in UserDefaults. Because a SpiceStore is an ObservableObject, it’s straightforward to observe the values in SwiftUI.

And because the @Spice property wrapper’s projected value is a publisher, it can be observed in UIKit with ExampleSpiceStore.$environment.sink(…).
February 19, 2025 at 6:08 PM
Using ObservableObject does indeed seem to avoid the issue. bsky.app/profile/simo...
Using ObservableObject instead of the Observation framework seems to resolve the issue. But is this really the route I want to take? ObservableObject seems to be soft-deprecated with the introduction of Observation.
December 19, 2024 at 12:42 PM
Using ObservableObject instead of the Observation framework seems to resolve the issue. But is this really the route I want to take? ObservableObject seems to be soft-deprecated with the introduction of Observation.
December 19, 2024 at 12:29 PM
I haven't tried with ObservableObject but I could give that a try. However, I'm also seeing the issue when `settings` isn't State, which I think addresses the issue described in the documentation (which I had forgotten about!)
December 19, 2024 at 12:10 PM
Cupertino - Plus de code iOS pourri avec vos assistants IA
Cupertino - Plus de code iOS pourri avec vos assistants IA
Vous développez une app SwiftUI et Claude vous balance du NavigationView alors qu’Apple recommande NavigationStack depuis la sorite d’iOS 16 ? Ou encore il vous sort @ObservableObject et @Published alors qu’on est passé à @Observable ? Bienvenue dans le club des devs qui passent plus de temps à corriger les hallucinations de leur IA qu’à coder… Ce problème, Aleahim, un développeuse macOS, en a eu marre alors elle a créé Cupertino , un serveur MCP qui donne accès à Claude à plus de 22 000 pages de documentation Apple en local . Plus besoin d’aller sur le net, et surtout plus d’excuses pour mélanger du code iOS 12 avec du SwiftUI moderne. Ainsi, au lieu de laisser Claude deviner les API (et se planter une fois sur deux), on lui file l’accès direct à la vraie doc. Les 261 frameworks Apple sont là, indexés dans une base SQLite locale, avec un moteur de recherche full-text qui répond en moins de 100ms. SwiftUI, UIKit, AppKit, Foundation, Core ML, ARKit… tout y est. L’écosystème se découpe ensuite en plusieurs repos GitHub. D’abord le serveur MCP principal qui fait le boulot d’indexation, ensuite un repo avec la doc pré-crawlée (parce que se taper 20 heures de téléchargement, merci mais non merci), et une collection de 606 projets d’exemple Apple officiels pour la route. De quoi transformer Claude en assistant qui connaît VRAIMENT la plateforme. Si ça vous intéresse, sachez qu’avant de vous lancer, faut être sur macOS 15 minimum avec Xcode 16 et Swift 6.2+. Côté espace disque, prévoyez 2-3 GB. Et si vous avez déjà bidouillé dans le terminal, que vous connaissez Git et que vous avez Claude Code installé, vous êtes bons. Comptez environ une quinzaine de minutes pour tout mettre en place. Et rassurez-vous, je ne vous laisse pas tomber, on va attaquer l’installation ensemble. D’abord, récupérez le projet et compilez-le : git clone https://github.com/mihaelamj/cupertino.git cd cupertino make build sudo make install Cette commande compile le projet Swift en mode release (ne faites pas attention aux warning éventuels) et copie le binaire dans /usr/local/bin/ . Vous devriez ensuite voir un message du genre “Build complete” suivi des chemins où le binaire est déployé. Maintenant passons sur la doc. Plutôt que de crawler vous-même les serveurs Apple pendant une journée entière, je vous recommande de récupérer la version pré-packagée. Ça prend 5 minutes au lieu de 20 heures, et franchement la vie est trop courte : git clone https://github.com/mihaelamj/cupertino-docs.git ~/.cupertino-docs Mais si vous tenez absolument à avoir la doc fraîche du jour (maniaque de la mise à jour, je vous vois), vous pouvez crawler ça vous-même : # Swift Evolution, ~5 minutes cupertino fetch --type evolution # Doc complète, ~20-24h cupertino fetch --type docs # Sample code Apple, ~4 minutes cupertino fetch --type samples Le crawler utilise un délai de 0,5 seconde entre chaque requête pour ne pas se faire blacklister par Apple. D’où les 20 heures… Ensuite, il faut construire l’index à l’aide de la commande suivante : cupertino save Puis lancer le serveur MCP comme ceci : cupertino serve Maintenant, passons à la connexion avec Claude Code. Alors pourquoi Claude Code, parce que c’est celui que j’utilise, c’est le meilleur, c’est mon préféré ❤️. Et c’est là que tout se joue, une seule commande : claude mcp add cupertino --scope user -- /usr/local/bin/cupertino Le --scope user fait que le serveur sera dispo dans tous vos projets, pas juste celui où vous êtes. Vous devriez voir : “ Added stdio MCP server cupertino with command: /usr/local/bin/cupertino to user config ”. Et maintenant pour vérifier que tout marche, lancez Claude Code avec claude puis tapez /mcp . Vous devriez voir cupertino dans la liste avec 3 outils : search_docs , list_frameworks et read_document . Vous pouvez aussi lancer cupertino doctor dans le terminal pour un diagnostic complet qui vérifie que le serveur MCP, le répertoire de doc et l’index de recherche sont bien en place. Testez en demandant à Claude de chercher quelque chose dans la doc Apple. Genre “NavigationStack iOS 16”. Il devrait utiliser l’outil search_docs et vous retourner la vraie documentation avec les bons exemples de code… pas du deprecated. Si vous avez l’erreur “command not found: cupertino”, le binaire n’est pas dans votre PATH. Vérifiez que /usr/local/bin y est bien ou relancez sudo make install . Si c’est “Database not found”, vous n’avez pas de doc indexée. Retournez chercher le repo cupertino-docs ou lancez le crawl. Et si le serveur ne se connecte pas à Claude Code, fermez Claude Code complètement et relancez-le car les serveurs MCP se chargent au démarrage. Voilà… Pour les devs Apple qui en ont marre de corriger les suggestions de Claude, Cupertino la formation Apple qu’il manquait à votre assistant IA ! Source
korben.info
December 3, 2025 at 6:41 AM
Add subscript methods to property wrapper types, and effortlessly unlock features like Published and AppStorage. when the wrapped value shifts, it seamlessly activates the objectWillChange publisher of an external ObservableObject, automatic update
fatbobman.com/en/posts/ad...
January 9, 2025 at 12:41 PM
Wait, what??

The #dotnetmaui team snuck this one through quietly! You can set compiled bindings now without having to specify the datatype when you set an explicit binding context!

When did this happen? How did I miss this?
November 26, 2024 at 9:26 PM
If I have a singleton class that's used in a SwiftUI view to do a network request, and I want it to hold state… do I actually need to change this to be Observable or ObservableObject, and not make it a singleton?
Cause when the view is redrawn, the value in the singleton is too?
October 24, 2024 at 9:52 PM
The following article talks about problems you may encounter when converting existing code from ObservableObject to the Observation framework :

https://captainswiftui.substack.com/p/objectively-better-observably-trickier

#swiftui
Objectively Better, Observably Trickier
The Observation Framework is great... once you figure out how it actually works
captainswiftui.substack.com
February 4, 2026 at 7:53 PM
The coding assistant in Xcode REALLY helped me with this. The key is basically that NSPersistentCloudKitContainer has an .eventChangedNotification that can be used to get an EventType enum that is returned (.setup, .import, .export). The AI set up an ObservableObject class that publishes a bool…
November 27, 2025 at 4:31 AM
Yeah, that doesn't work for my menus… get no ObservableObject found. A View.environmentObject(_:) may be missing as an ancestor of this view. Makes sense because it isn't applied at that level but inside it. I guess that was something that must have changed in macOS 14+. 😕
March 21, 2025 at 11:53 PM
Thanks for sharing it ❤️ I was so used to just retrieving the combine stream from published properties that I had to find a similar alternative with async streams.

Not as straightforward as with ObservableObject, but does the trick!! 🚀
November 30, 2024 at 3:12 PM
Is it bad practice to use ObservableObject in non-ViewModel classes when working with the MVVM Community Toolkit?

#csharp #dotnet
Is it bad practice to use ObservableObject in non-ViewModel classes when working with the MVVM Community Toolkit?
I need to use `NotifyPropertyChanged` when `_currentModalViewModel` changes, but I'm not sure if it's a good practice because I associate...
old.reddit.com
January 20, 2025 at 5:23 PM
Tutorial 13: Observable Objects and Environment Objects in SwiftUI
# Observable Objects and Environment Objects in SwiftUI ## Introduction In this tutorial, we'll explore **ObservableObject** and **EnvironmentObject** in SwiftUI, which are essential for managing state in your app. We'll use these concepts to build a simple iPhone game. By the end of this tutorial, you'll understand: * The difference between `@State`, `@ObservedObject`, and `@EnvironmentObject` * How to use `ObservableObject` to manage data * How to share data across views with `EnvironmentObject` * How to apply this knowledge to build a simple game in SwiftUI * How to apply SwiftUI in **VS Code** ## Prerequisites Before we begin, ensure you have: * Xcode installed (latest version recommended) * Swift knowledge (basic to intermediate level) * VS Code with the Swift extension installed (for alternative development) ## Understanding SwiftUI State Management ### `@State` * Used for simple state management inside a single view. * Automatically refreshes the view when the state changes. Example: struct CounterView: View { @State private var count = 0 var body: some View { VStack { Text("Count: \(count)") Button("Increment") { count += 1 } } } } ### `@ObservedObject` * Used when multiple views need to share state. * Requires a class conforming to `ObservableObject`. Example: class CounterModel: ObservableObject { @Published var count = 0 } struct CounterView: View { @ObservedObject var model = CounterModel() var body: some View { VStack { Text("Count: \(model.count)") Button("Increment") { model.count += 1 } } } } ### `@EnvironmentObject` * Used to inject shared data into multiple views without explicitly passing it. * Requires a `.environmentObject()` modifier on a parent view. Example: class GameSettings: ObservableObject { @Published var score = 0 } struct ScoreView: View { @EnvironmentObject var settings: GameSettings var body: some View { Text("Score: \(settings.score)") } } ## Building a Simple Game: Tap The Circle ### Step 1: Create a Game Model class GameModel: ObservableObject { @Published var score = 0 @Published var position = CGPoint(x: 100, y: 100) } ### Step 2: Build the Game View struct GameView: View { @EnvironmentObject var game: GameModel var body: some View { ZStack { Color.blue.edgesIgnoringSafeArea(.all) Circle() .fill(Color.red) .frame(width: 50, height: 50) .position(game.position) .onTapGesture { game.score += 1 game.position = CGPoint(x: CGFloat.random(in: 50...350), y: CGFloat.random(in: 50...700)) } VStack { Text("Score: \(game.score)") .font(.largeTitle) .padding() Spacer() } } } } ### Step 3: Setup the Root View @main struct MyApp: App { @StateObject private var game = GameModel() var body: some Scene { WindowGroup { GameView() .environmentObject(game) } } } ## Conclusion In this tutorial, you learned how to use `@State`, `@ObservedObject`, and `@EnvironmentObject` in SwiftUI. You also built a simple game that updates the UI dynamically using these concepts. Finally, you explored how to work with SwiftUI in VS Code. With this knowledge, you can now build more complex and interactive SwiftUI applications!
forem.com
March 31, 2025 at 12:40 PM
Almost forgot and this one is a bit harder to explain.

But realizing dependency injection in SwiftUI for something like an atproto client can be as easy as a ObservableObject created on the ContentView and passed down as a EnvironmentObject
June 28, 2025 at 5:00 AM
The post explains how to add camera features to SwiftUI by bridging UIKit with AVFoundation.

The author builds a CameraManager, a UIViewRepresentable preview, and SwiftUI views using ObservableObject and delegate patterns.

www.createwithswift.com/integrating-...
Integrating Device Camera in SwiftUI Apps
Learn how to bridge UIKit and AVFoundation with SwiftUI to integrate camera functionality.
www.createwithswift.com
November 5, 2025 at 5:47 AM