How to declare:
As atomic is default so,
@property (retain) NSString *name;
AND in implementation file
self.name = @"sourov";
Suppose a task related to three properties are
@property (retain) NSString *name;
@property (retain) NSString *A;
@property (retain) NSString *B;
self.name = @"sourov";
All properties work parallelly (like asynchronously).
If you call "name" from thread A,
And
At the same time if you call
[self setName:@"Datta"]
from thread B,
Now If *name property is nonatomic then
Thats why non atomic is called thread unsafe But but it is fast in performance because of parallel execution
Now If *name property is atomic
That's why atomic is called thread Safe and That's why it is called read-write safe
Such situation operation will perform serially. And Slow in performance
- Nonatomic means multiple thread access the variable(dynamic type).
- Nonatomic is thread unsafe.
- but it is fast in performance
-Nonatomic is NOT default behavior, we need to add nonatomic keyword in property attribute.
For In Swift Confirming that Swift properties are nonatomic in the ObjC sense. One reason is so you think about whether per-property atomicity is sufficient for your needs.
Reference: https://forums.developer.apple.com/thread/25642
Fro more info please visit the website http://rdcworld-iphone.blogspot.in/2012/12/variable-property-attributes-or.html