Native Swift code won't ever use autorelease, and the default calling convention indeed is like ns_returns_retained
. Unlike ObjC, callers are also responsible for guaranteeing the lifetime of all arguments, so arguments do not need to be defensively retained either. However, if Swift calls into Objective-C code, or Objective-C calls into @objc
Swift methods, then Swift will still retain compatibility with the Objective-C conventions, including autoreleasing return values.
5 Likes