Am I misunderstanding the expected behavior here, or is there a bug in the behavior of @Attribute(.ephemeral)
tagged SwiftData model properties?
The documentation for .ephemeral
says "Track changes to this property but do not persist". I started using .ephemeral
because @Transient
was inhibiting SwiftUI from reacting to changes to the property through @Observable
.
I am updating the value of my @Attribute(.ephemeral)
property about once a second and I am seeing corresponding console log output showing the property as part of the generated CKRecord
object. I then confirmed in the CloudKit dev portal that the .ephemeral
property was added to the Record schema and contains real values. The behavior seems as though the .ephemeral
property is being completely ignored.
This is observed in a new Xcode project using SwiftData with CloudKit, Xcode 16.2, macOS 15.3.1 and during Build & Run testing on physical devices.