I'm trying to implement custom NSTextContentManager
and use it with NSTextView
, however it seems that NSTextView
expect NSTextContentStorage
all the time.
final class MyTextContentManager: NSTextContentManager {
// ...
}
It's added to layout manager, and NSTextView
instance finds it properly:
let textContentManager = MyTextContentManager() textContentManager.addTextLayoutManager(textLayoutManager)
however, when I use it, I see errors at:
[MyTextContentManager textStorage]: unrecognized selector sent to instance 0x600003d84870
the textStorage
property is part of NSTextStorageObserving
, that is not NSTextContentManager
interface.
It looks like NSTextView
is not ready to work with custom NSTextContentManager
. What did I miss?
I am trying to provide my own NSTextLocation subclass and I encounter a similar problem: an unrecognized selector
range
is sent to an NSTextRange instance that I create.It seems like it may be necessary to subclass every class in the cluster NSTextContentManager <-> NSTextLayoutManager <-> NSTextLocation to produce something that works.
Can Apple provide any guidance?