Does ARC eliminate the need for properties in Objective-C?

Possible duplicate:
With ARC, why use @properties anymore?

NB: Actually, I don’t think we can do away with properties, but I’m trying to understand why it’s not. :)

Returning to this question , it seems to us that the main reason we use properties is to avoid memory management problems. In other words, by creating a property, we get rid of the need to write down all of these save and release methods:

- (void) setOtherObj:(MyOtherObject *)anOtherObject {

    if (otherObject == anOtherObject) {
    return;  
    }

    MyOtherObject *oldOtherObject = otherObject; // keep a reference to the old value for a second
    otherObject = [anOtherObject retain]; // put the new value in  
    [oldOtherObject release]; // let go of the old object
} 

Since ARC is dealing with this now, could we end the properties together and just install ivars by doing something like otherObject = anotherObject?

+3
source
3

, . , . .

. , backgroundColor , backgroundColor subview. , , readonly name, , firstName lastName.

, .

, , - , , .

+5

. (readonly vs. readwrite), (.. - , ). , copy, - ARC.

+2

ARC , . - / . , ARC .

0
source

All Articles