I am aware of this question regarding how we can get a readable class name of an objective-c class in Swift.
What I want to achieve is getting the readable class name of a Swift class from inside objective-c without mangling the class name with the module.
So if I have a Swift class:
class Foo: NSObject{}
Then inside Objective-C I would love to use the convenient NSStringFromClass to convert the class name to a string.
I would expect NSStringFromClass([Foo class])
to return @"Foo"
but instead it returns @"Bar.Foo"
withBar
being the module name.
I came across this Gist but it seems a little hacky and messy, is there a better way? Something that doesn't include typing the class name manually into a string would be preferred.