Reputation: 126457
Why not just use a regular @property instead of transient? I don't care about supporting undo.
Upvotes: 2
Views: 959
Reputation: 7327
If you don't need undo, there's a good chance a plain unmodeled @property is better. When explicitly modeling a property as transient, the main differences are:
Some experiments working out the semantics of a transient modeled property might be found at https://web.archive.org/web/20160423093331/http://www.2pi.dk/tech/cocoa/transient_properties.html by Jakob Stoklund Olesen. Because that's a dying archive.org link, I'll excerpt some choice tidbits:
"A transient property ... You should be thinking of it as something whose value is nil in the persistent store."
"So what are transient properties good for? ... [for] any property you don't need to be stored, but would like undo support for."
"Another use ... is caching for properties that can't be stored. Cross-store relationships and attributes with unsupported types are the typical examples. Before saving, you convert the property into something that can be stored, and write it to a binary 'shadow' attribute."
"It is better to imagine transient properties as representing 'something that is nil in the persistent store', than the common 'fancy instance variables with undo'."
A good article and I wish Jakob had left it up.
Upvotes: 3