Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean to create an object using: id <class> instanceName?

I saw some code on the apple website that goes like this

id <NSFetchedResultsSectionInfo> sectionInfo = ...

How is this different to the following?

NSFetchedResultsSectionInfo *sectionInfo = ...

I'm not so interested in NSFetchedResultsSectionInfo itself, but rather the way it's declared.

Thanks a bunch!
Tristan

like image 263
WoodenKitty Avatar asked Feb 25 '23 04:02

WoodenKitty


1 Answers

NSFetchedResultsSectionInfo is a protocol. id is a way of declaring a generic object, and id <NSFetchedResultsSectionInfo> declares a generic object that must adhere to the NSFetchedResultsSectionInfo protocol.

like image 78
jakev Avatar answered May 13 '23 01:05

jakev