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 7571067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:34:52+00:00 2026-05-30T15:34:52+00:00

If assign is a setter, but a property is readonly , then it will

  • 0

If assign is a setter, but a property is readonly, then it will not be doing any setting, so why use assign ?

I am getting this from the Apple docs on class extensions. In this page, I get why you’d want a public readonly property, then make it privately readwrite, but then why not omit the assign from the public @interface and just include it in the class extension only?

  • 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-30T15:34:53+00:00Added an answer on May 30, 2026 at 3:34 pm

    If you declare a @property multiple times (typically because you declare a public readonly property in the header file, and a readwrite property in an anonymous category in your .m), the memory management schemes have to match.

    So if you have this in your .m:

    @property (assign, readwrite) NSObject *foo;
    

    Then you need this in your header, and the assign is mandatory:

    @property (assign, readonly) NSObject *foo;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When i write something like this: <Style x:Key=panelS> <Setter Property=Orientation Value=Horizontal /> <Setter Property=DockPanel.Dock
Let's say we have a XAML code like this: <Style TargetType={x:Type ListBoxItem}> <Setter Property=Template>
For this example, I am working with objective-c, but answers from the broader C/C++
I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal
I want to assign a class attribute via a string object - but how?
I know this has been discussed ad-nauseum but I just don't get some of
I found a lot of posts that dodge this topic, but none that actually
I can't figure out why my getter and setter code is not working. In
This is causing a StackOverFlow error and I have an idea why, but I
There is Class A with: @interface ClassA : NSObject { } @property (nonatomic, assign)

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.