Skip to content

Instantly share code, notes, and snippets.

@mikeash
Created October 12, 2017 13:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeash/d607b4f6eb8eace4b9bdfbf2ccdd19c6 to your computer and use it in GitHub Desktop.
Save mikeash/d607b4f6eb8eace4b9bdfbf2ccdd19c6 to your computer and use it in GitHub Desktop.
import Cocoa
var count: UInt32 = 0
let ptr = objc_copyClassList(&count)!
let strings = (0 ..< Int(count)).flatMap({
if class_getSuperclass(ptr[$0]) == nil {
return String(cString: class_getName(ptr[$0]))
} else {
return nil
}
})
print(strings.joined(separator: ", "))
// NSLeafProxy, __NSGenericDeallocHandler, _NSZombie_, Object, SwiftObject, __NSMessageBuilder, NSProxy, __NSAtom, NSObject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment