开发者

Subclassing/extending NSMutabelSet?

开发者 https://www.devze.com 2023-01-04 02:51 出处:网络
Is it possible to to subclass NSMutableSet? I need to do this in order to not retain objects contained in this set. The purpose todo that is to make an set of observers and those do not need to be ret

Is it possible to to subclass NSMutableSet? I need to do this in order to not retain objects contained in this set. The purpose todo that is to make an set of observers and those do not need to be retained.

Is it possible to do th开发者_运维知识库is or maybe you have an another solution.

Needles to say, I do know KVO but the pattern I have described above suites me better.

Cheers, Lukasz


One possibility would be to use CFMutableSet. When you create one with CFSetCreateMutable, you can specify callbacks that define how retain and release work. And this is toll-free bridged with NSMutableSet.

0

精彩评论

暂无评论...
验证码 换一张
取 消