CFGetRetainCount returns 2 after creating the object, should it be 1?

When I do a hold on this object, this is 2. Why is this? Of course, this should be one, since I just initialized it and did not assign it or something else ...

let testC: TestClass = TestClass()
print(CFGetRetainCount(testC))

This was done in an empty project with one xcode view ... TestClass is an empty class, and viewcontroller is one instance of the instance, holding count is 2:

View Controller creates one test class

empty class

+4
source share

Source: https://habr.com/ru/post/1664148/


All Articles