I am trying to understand how the Any type is implemented, but I cannot find any information about it (e.g. searching for "swift string implementation" leads to String.swift from the standard library and one can find StringGuts.swift from there, but nothing turns up for "Any", partly because it is such a generic word.)
-
How is Any implemented? I assume it is a struct with at least a pointer to the actual value. Is there source code available for the implementation (similar to String)?
-
Where is the type information stored? Is it stored on the struct or behind some pointers?
-
How does assigning a value type to Any work in terms of memory management? Is the value copied to the heap?
Thank you!