thank you for coming up with such a novel way of exploring / calling APIs. When searching for the right API to call, it's sometimes useful to log an object's properties. Is this something you'd consider adding to the framework?
extension NSObject {
var properties: [String] {
var count : UInt32 = 0
let typeOf = type(of: self)
guard let properties: UnsafeMutablePointer<objc_property_t> = class_copyPropertyList(typeOf, &count) else { return [] }
var names: [String] = []
for i in 0..<Int(count) {
let property : objc_property_t = properties[i]
guard let name = NSString(utf8String: property_getName(property)) as String? else { continue }
names.append(name as String)
}
free(properties)
return names
}
}
thank you for coming up with such a novel way of exploring / calling APIs. When searching for the right API to call, it's sometimes useful to log an object's properties. Is this something you'd consider adding to the framework?