Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.