 public func allSubclassesOf<T>(_ baseClass: T) -> [T] {
     var matches: [T] = []
 
-    // Get all the classes which implement 'baseClass' and return them
-    // Helped by code from https://gist.github.com/bnickel/410a1bdc02f12fbd9b5e
-    let expectedClassCount = objc_getClassList(nil, 0)
-    let allClasses = UnsafeMutablePointer<AnyClass?>.allocate(capacity: Int(expectedClassCount))
-    let autoreleasingAllClasses = AutoreleasingUnsafeMutablePointer<AnyClass?>(allClasses) // Huh? We should have gotten this for free.
-    let actualClassCount = objc_getClassList(autoreleasingAllClasses, expectedClassCount)
-
-    for i in 0..<actualClassCount {
-
-        guard let currentClass = allClasses[Int(i)] else {
-            continue
-        }
+    for currentClass in allClasses() {
 
         guard class_getRootSuperclass(currentClass) == NSObject.self else {
             continue


    return class_getRootSuperclass(superclass)
}

        }
    }

    return matches
}

