SwiftData is Apple’s modern persistence framework, designed to be Swift-friendly.
It uses property wrappers to define how properties are stored. Examples include:
@Attribute (which can accept parameters such as .unique or .defaultValue) for persistent attributes.
@Transient (or, in some contexts, @Ephemeral) for properties that aren’t meant to be stored persistently.
Example:
struct MyModel { @Attribute(.unique) var id: UUID @Attribute(.defaultValue(0)) var count: Int @Transient var tempValue: String // temporary value not stored persistently}