Objective-C and Protocols

Do the protocols have any overhead? (i.e. obvious benefits to the side, do they slow down?)

+3
source share
1 answer

From a run-time point of view (and as far as I know), protocols do not affect performance, since the cost of sending a message is the same, regardless of whether the instance refers to its class or the corresponding protocol.

From a programming point of view, protocols provide more flexibility, especially when developing low-link APIs. The Protocol chapter in the Objective-C Programming Guide describes the features provided in some detail. You can take a look at it.

+3
source

Source: https://habr.com/ru/post/1747543/


All Articles