What does id<…> mean in Objective-C?

后端 未结 5 1637
太阳男子
太阳男子 2021-01-03 22:48

I\'m trying to use Google Analytics in an iOS application, and I saw this portion of code :

id tracker = [[GAI sharedInstance] defaultTrack         


        
5条回答
  •  太阳男子
    2021-01-03 23:40

    Here id is a pointer that hold an object.

    and tracker is an instance that conforms to GAITracker protocol.

    Protocols make it possible for two classes distantly related by inheritance to communicate with each other to accomplish a certain goal. They thus offer an alternative to subclassing.

提交回复
热议问题