When to use attributes and What is the purpose of each attribute?
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.
Some attributes:
readonly – use if you don’t want a setter
retain – use if you want values assigned to your property to be retained
copy – use if you want values assigned to your property to be copied.
assign – use if you want new values to be assigned with no retain or copy.
nonatomic – use to disable the mechanism that makes property access atomic. An atomic property is guaranteed to give you a pointer to a real object that still exists or nil. In a multithreaded environment, a nonatomic property could give you an object that has already been deallocated.