What is the default property value if I just do the following:
@property (nonatomic) UIButton *myButton;
in a non-ARC project. Is this retain or assign?
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.
Since in non-ARC projects of any size its pretty important to see exactly whats retained and assigned or copied, I would really recommend not using that default.
Its hard to read when your looking at a class with several properties that may have many other attributes such as readonly, atomic and non atomic. getter= etc
Although its not perfect putting a #define in a constant header like
for your most common usages can make your property definitions a little more explicit
so that when you eventually catch up to writing your dealloc methods its a really quick check to see what you need to release.
Most of my property definitions looks like
or
Thats what I do and it keeps the noise on property definitions down and makes the code read a little easier when troubleshooting or perfecting manual memory managed apps.