O'Reilly logo

Swift High Performance by Kostiantyn Koval

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Method calls

Before discussing Swift method calls optimization, it would be very useful to have a look at different types of method call implementation.

There are two main types of method call:

  • Static: Static method binding means that, when you call a method on the object, the compiler knows that you are calling exactly this method on exactly this class. C is an example of a language with static method binding.
  • Dynamic: On other hand, dynamic has a weak binding between the method and the object. When you call a method on the object there is no guarantee that an object can handle this method call. Objective-C has a dynamic method binding. That's why you can see the object does not respond to selector error in Objective-C.

Objective-C is a dynamic-type ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required