0
Are id and instanceType same? If not, what are differences between them in Objective-C?

Open 1 Answers 36 Views Technology
Are id and instanceType same? If not, what are differences between them in Objective-C?

1 Answer

0

In your code, replace occurrences of id as a return value with instancetype where appropriate. This is typically the case for init methods and class factory methods. Even though the compiler automatically converts methods that begin with “alloc,” “init,” or “new” and have a return type of id to return instancetype, it doesn’t convert other methods. Objective-C convention is to write instancetype explicitly for all methods.

by (280k points)
...