Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

@Property Method: What is 'nonatomic' and 'strong'?

The course for objective-c was very nice, but I did not quite understand what these two parameters in the @property method meant. Could anyone elaborate?

Thank you in advance.

2 Answers

The 'nonatomic' property is the opposite of the default 'atomic' property. A variable with the 'nonatomic' property means that the variable is not thread safe. This might sound scary, but it just means that the variable can be accessed from multiple threads at the same time. The 'atomic' property does not allow this, which makes the 'nonatomic' property faster to use.

The 'strong' property replaced the 'retain' property. The 'strong' property is required when the attribute is a pointer to an object, and it will be retained in memory. The opposite of this is the 'weak' property.

Very good explanation. I understand those concepts now. Thank you for your help.

Stone Preston
Stone Preston
42,016 Points

This page helped explain ARC stuff pretty well for me. It can be kind of hard to understand

Thank you for the article. It helped a lot.