ARC and init

I heard that "Methods starting with init or new or containing copy transfer, by definition, ownership; all other methods do not.

Does this apply to ALL methods with the word "init" in the name, even if the function is "initialCapitalizationMode", in which initial does not mean the same as init? Or does it only work if it has "init" and then an uppercase letter after the fact?

Replies

Does this apply to ALL methods with the word "init" in the name, even if the function is "initialCapitalizationMode", in which initial does not mean the same as init?

No.

Or does it only work if it has "init" and then an uppercase letter after the fact?

Yes. Well, I’m not sure if the uppercase capital is a sufficient test, maybe there are some other exceptions.

My go-to reference for this stuff is the Clang Objective-C Automatic Reference Counting doc.

https://clang.llvm.org/docs/AutomaticReferenceCounting.html

The info you want is in Section 5 Method families.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"