Why not just use a regular @property instead of transient? I don’t care about supporting undo.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.