Please visit the new Mac-Forums Facebook page:

Results 1 to 2 of 2
  1. #1
    What does nonatomic and retain do in Objective-C?

    Member Since
    Feb 21, 2011
    Your Mac's Specs
    Macbook Air 11", 64 GB, Intel core i5, 1.6 GHz, OSX Lion 10.7
    Rep Power
    What does nonatomic and retain do in Objective-C?
    Hello every1

    In objective-c when we apply synthesize accessor method or when we write property, we also use 2 terms, they are: nonatomic and retain. the syntax is given below:

    @property(nonatomic, retain)

    I would like to know what exactly nonatomic and retain do.
    Please guide
    reply soon..


  2. #2
    What does nonatomic and retain do in Objective-C?
    xstep's Avatar
    Member Since
    Jun 25, 2005
    On the road
    Your Mac's Specs
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    Rep Power
    Both are discussed here in The Objective-C Programming Language. Search that document for those two words.

    In short...

    The nonatomic directive means no locking of the variable is done during access. This speeds up access. In a multithreading scenario that could be a bad thing.

    The retain directive means that upon assignment, the object will be retained. If you override the properties setter method, I believe you are then responsible for the retain.
    CameraTime - Time lapse photography for novice and advanced users.

    When asking questions, post the version of your software. You'll receive better answers.

    Please post your results to the thread as it is good feedback.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Certain Mac Preferences do not retain settings
    By santinir in forum macOS - Operating System
    Replies: 0
    Last Post: 12-15-2014, 02:46 AM
  2. Format and retain boot camp?
    By oli271 in forum macOS - Operating System
    Replies: 6
    Last Post: 04-16-2010, 02:53 PM
  3. Retain 5.1 audio when burning DVD
    By Coaster75 in forum Movies and Video
    Replies: 2
    Last Post: 03-30-2010, 09:30 AM
  4. How can I reformat, use bootcamp and retain image?
    By Isidore in forum macOS - Operating System
    Replies: 3
    Last Post: 10-25-2009, 10:44 AM
  5. Desktop Background won't retain
    By BlzBub in forum macOS - Operating System
    Replies: 2
    Last Post: 01-26-2009, 12:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts