struct Struct { } enum Enum { } protocol Protocol { } func kind(_ type: Any.Type) -> Int { return unsafeBitCast(type, to: UnsafeMutablePointer<Int>.self).pointee } print(kind(Struct.self)) // 1 print(kind(Enum.self)) // 2 print(kind(Protocol.self)) // 12
(edited)