dynamic
概要
Swift には dynamic という declaration modifiers がある。この修飾子が付与されたクラスのメンバは、Objective-C Runtime を利用して動的ディスパッチされ、コンパイラによってインライン展開や devirtualized されない。また、Objective-C Runtime を利用するため、objc 属性も付与する必要がある。
Apply this modifier to any member of a class that can be represented by Objective-C. When you mark a member declaration with the dynamic modifier, access to that member is always dynamically dispatched using the Objective-C runtime. Access to that member is never inlined or devirtualized by the compiler.
Because declarations marked with the dynamic modifier are dispatched using the Objective-C runtime, they must be marked with the objc attribute.
https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#//apple_ref/swift/grammar/declaration-modifiers
つまりどういうこと?
コンパイラの最適化に関わってくるらしい。
https://ufcpp.net/blog/2018/12/devirtualization/
動的ディスパッチが使えるようになるよ、くらいに思っておくと良さそう?
https://qiita.com/takecian/items/882a0441b5694a4fd5e7#dynamic-キーワード