It can be difficult to find a clear, concise explanation of how method dispatch works in Swift, when calls are resolved statically or dynamically, and what that means for performance.

I wrote a post summarizing my learnings, with key cases and examples: https://nilcoalescing.com/blog/MethodDispatchMechanismsInSwift/

#Swift #iOSDev

Method dispatch mechanisms in Swift: static and dynamic dispatch

Dive into how static and dynamic dispatch work in Swift, how they affect performance, and how to control method resolution to write faster, more efficient code.

Nil Coalescing
@natpanferova one thing I’m trying to figure out is when will swift decide to use the async overload version. Sometimes Swift will insist on using non-async version even though I’m in an async context and called it with await.
@natpanferova Similarly I have a typed throws and non-typed throws overload and I can’t predict which will be called.
Mermaid Chart - Create complex, visual diagrams with text. A smarter way of creating diagrams.