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 https://opensource.apple.com/source/objc4/objc4-706/runtime/objc-internal.h.auto.html which does what I would expect in this case, but it is not even part of https://clang.llvm.org/docs/AutomaticReferenceCounting.html.

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