Weak reference to object being deallocated

Related to Hashing Weak Variables.

I want to create my WeakRef for object being deallocated in order to find it among array of WeakRef's and delete it. This works fine for pure Swift classes, but triggers a runtime error for ObjC classes.

Difference in behaviour is confusing, IMO two cases should behave the same way.

And behaviour of the Swift case seems more logical to be - it produces a nil weak reference. Any reasons why the same is not possible for NSObject subclasses?

There is an internal function objc_initWeakOrNil
from objc-internal.h which does what I would expect in this case, but it is not even part of Objective-C Automatic Reference Counting (ARC) — Clang 16.0.0git documentation.

Should Swift runtime use objc_initWeakOrNil instead of objc_initWeak for consistent behavior of weak references?