i m a beginner iphone developer and i want to know about what is the use of @property (nonatomic, retain) statement with example , any body can give me any answer ?
Nonatomic means multiple thread access the variable (dynamic type). Nonatomic is thread unsafe. But it is fast in performance.
retain = strong -it is retained, old value is released and it is assigned -retain specifies the new value should be sent -retain on assignment and the old value sent -release -retain is the same as strong. -
nonatomic property means @synthesize d methods are not going to be generated threadsafe -- but this is much faster than the atomic property since extra checks are eliminated. strong is used with ARC and it basically helps you , by not having to worry about the retain count of an object.
In mathematics, more precisely in measure theory, an atom is a measurable set which has positive measure and contains no set of smaller positive measure. A measure which has no atoms is called non-atomic or atomless.
@property tells Objective-C to generate the getters and setters for this member variable when it is @synthesize'd in the implementation class. The retain parameter says that the generated setter should pass the retain message to the parameter being set. nonatomic means that atomicity of getting and setting the variable is not guaranteed.
Apple has a lot of examples in the Declared Properties section of their Objective-C Programming Language guide. Definitely worth reading through.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With