instancetype
instancetype
is a contextual keyword that can be used as a result type to signal that a method returns a related result type.[…]
With
instancetype
, the compiler will correctly infer that the result of+personWithName:
is an instance of aPerson
.