By default, a type that is defined by a dylib has a resilient layout. This means that the size, alignment, stride, and extra inhabitants of that type aren't statically known to the application. To get that information, it must ask the dylib for that type's value witness table at runtime.
[...]
Unlike Rust and C++ which must monomorphize (copy+paste) implementations for each generic/template substitution, Swift is able to compile a generic function into a single implementation that can handle every substitution dynamically.
[...]
[...] Swift uses reabstraction thunks. These thunks simply wrap a function with the wrong ABI in a function with the right one.
From the article:
[...]
[...]