Re: Implementing NSFastEnumeration

Kyle Sluder <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Thu, Oct 1, 2009 at 9:43 AM, Gerd Knops <[email protected]> wrote:
> AFAIK subclassing class clusters doesn't work, which is why I think they are
> a poor design.

It is certainly possible to subclass a class cluster.  Sometimes it's
not easy.  A common strategy is to implement the subclass with an ivar
of the superclass type, like so:

@interface MyAttributedString : NSAttributedString
{
@private
  NSAttributedString *originalString;
}

@end

And then implement the documented primitive methods in terms of this ivar.

--Kyle Sluder
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.