Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7436511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:15:04+00:00 2026-05-29T10:15:04+00:00

This is a two part question in hopes that I can understand more about

  • 0

This is a two part question in hopes that I can understand more about the topic.

1) It seems to me that you have two popular options for declaring a property for a class in objective c. One is to add the property to the header’s class body eg.

@interface MyClass : NSObject {
    NSArray *myArray;
}

Or you can add it after the @interface body and before the @end statement like so.

@interface MyClass : NSObject {
    //
}

@property (nonatomic, retain) NSArray *myArray;

What is the difference between these two “styles” and when do you choose one over the other?

2) after the @property you find options such as (nonatomic, retain). What are those for and why/when do you use different options?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:15:05+00:00Added an answer on May 29, 2026 at 10:15 am

    Here are the only property modifiers that Xcode recognizes:

    • nonatomic (does not enforce thread safety on the property, mainly for use when only one thread shall be used throughout a program)
    • atomic (enforces thread safety on the property, mainly for use when multiple threads shall be used throughout a program) (default)
    • retain / strong (automatically retains / releases values on set, makes sure values do not deallocate unexpectedly) (default if ARC and object type)
    • readonly (cannot set property)
    • readwrite (can both set and get property) (default)
    • assign / unsafe_unretained (no memory management shall be done with this property, it is handled manually by the person assigning the value) (default if not ARC or object type)
    • copy (copies the object before setting it, in cases where the value set must not change due to external factors (strings, arrays, etc).
    • weak (automatically zeroes the reference should the object be deallocated, and does not retain the value passed in)
    • getter=method (sets the selector used for getting the value of this property)
    • setter= method (set the selector used for setting the value of this property)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is a two part question that probbably have a similar answer. I want
This is kinda....a two part question. The first one is much more important than
This is a two part question; firstly, does anyone out there have some insight
This is a two part question. The first is a specific question about DataSets
This is part question, and part hope for confirmation. I have my suspicions about
This is a two part question. I'm needing to restrict a rails site that
This is a two part question, but first some background information: I have a
This is a two part question. First how can I grab the last url
This is a two-part question about adding a third-party library (JAR) to an Android
This is a two part question. Is it possible to take advantage of xVal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.