-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
If you try to reflect an instance of a class that inherits from NSObject, it will crash while accessing a null pointer when trying to reflect NSObject.
The minimal example would be:
class Foobar: NSObject {
var stringProperty: String = "foobar"
}
let instance = Foobar()
try! properties(instance)I have an example traceback in the attached screenshot. I tried with Swift 3.3 and Swift 4.1.
I see that there's already a workaround in the superclass reflection where we exclude the SwiftObject superclass:
| guard let superclass = superclass, String(describing: unsafeBitCast(superclass.pointer, to: Any.Type.self)) != "SwiftObject" else { |
Would it make sense to exclude the NSObject superclass in the same way? Or is reflecting on classes inherited from NSObject in general not supported?
Metadata
Metadata
Assignees
Labels
No labels
