Daily iOS
Swift

Method dispatch

In Swift, which method calls use static, table, and message dispatch?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Static dispatch (struct, enum, final, private, extension) can be inlined and is fastest; class methods go through the vtable, protocol requirements through the witness table, and @objc dynamic uses ObjC message sends.

Share a question