Found the details in the clang documentation.
init
implicitly uses the __attribute__((ns_consumes_self))
attribute, meaning that while self
is defined as __strong id self
, the initial assignment does not perform a retain. This means as soon as self
is reassigned or the function terminates, self
will be released using standard strong rules.
To get an +1 out, there is an implicit __attribute((ns_returns_retained))
which prevents the returned object from being released at the end.
At a high level, ARC plans to release the initial value of self
one extra time by the end of the function, while also retaining the return value, maintaining its +1 output.