isUniquelyReferenced and NonObjectiveCBase

I'm having trouble figuring out how these are supposed to be used.


The following code gives the error "Cannot invoke 'isUniquelyReferenced' with an argument list of type '(inout Test)'".


class Test {}
var t = Test()
isUniquelyReferenced(&t)


I tried to fix that by inheriting from NonObjectiveCBase as the documentation seems to indicate, however that also does not work. The following code gives the error "'NonObjectiveCBase.Type' does not have a member named 'init'."


class Test: NonObjectiveCBase {
    init() {
        super.init()
    }
}


And of course if you try to omit the call to super.init you receive an initializer error.


Does anyone have a working example of how this is used?

Answered by tompelaia2 in 30824022

Can you use isUniquelyReferencedNonObjC() instead?

Accepted Answer

Can you use isUniquelyReferencedNonObjC() instead?

Thanks, not sure how I missed that. 😊


If anyone from Apple is reading, I am curious to know what the purpose of NonObjectiveCBase given that it appears we cannot actually us it.

isUniquelyReferenced and NonObjectiveCBase
 
 
Q