From iOS 5, we have found a key word -> "instancetype", looks like it is same with the common type "id", so what's the different between them? this
1.instancetype -> Related Result Types(相關返回類型), it means the variable of this type, it will include the class's info. spa
e.g. If 'NSArray''s class method 'array' return 'id' type, if user use invoke one method not in the NSArray, just like this: .net
[[NSArray array] methodNotInClass]; // **** no error
but if the method 'array' return 'instancetype' type, the code above will pop up error that without this method in the class, that's because the method 'array''s return value will include all the info of class. code
2. 'instancetype' can not used as the type of method's params. blog
Reference:http://blog.csdn.net/cancer1617/article/details/21372353 get