Hello,
I want to subclass NSDocumentController, but I could not find the information in Apple document how to subclass.
According to ChatGPT, it can be instantiated by [MyDocumentController sharedDocumentController]; before NSApplicationMain() as the following code. It seems working well in my test environment.
int main(int argc, const char * argv[]) {
[MyDocumentController sharedDocumentController];
NSApplicationMain(argc, argv);
}
But, I am not sure whether it is officially correct to instantiate so early (before calling NSApplicationMain).
Is there any official information what is correct way to instantiate subclass of NSDocumentController?
Post
Replies
Boosts
Views
Activity
I am revising my app to support NSWritingToolsCoordinator/ NSWritingToolsCoordinatorDelegate.
When proofreading some paragraphs, it works well.
But, when proofreading many paragraphs (for example, 56 paragraphs), it can't complete the proofreading.
I am not sure which is wrong with my app or macOS API.
I think I implemented all NSWritingToolsCoordinatorDelegate methods.
Is there any information for such an issue?
Phenomenon
For paragraphs 1-9, text animation completed. But, for paragraphs 10-56, text animation does not complete.
It shows 5 corrected items, but I can't jump to items 3, 4, 5, when I click the ">" button in the "Proofread" window.
Items 3, 4, 5 were not corrected actually.
Log
For each NSWritingToolsCoordinatorDelegate method, the method name and main arguments are output by NSLog.
requestsContextsForScope
willChangeToState newState:2
requestsPreviewForTextAnimation range:(0, 18233)
prepareForTextAnimation range:(0, 18233)
willChangeToState newState:3
requestsPreviewForTextAnimation range:(0, 18233)
finishTextAnimation range:(0, 18233)
requestsPreviewForRect
requestsPreviewForTextAnimation range:(0, 1837)
replaceRange proposedText:an range:(208, 2)
replaceRange proposedText:you range:(443, 4)
prepareForTextAnimation range:(1836, 16396)
requestsPreviewForTextAnimation range:(0, 1836)
requestsBoundingBezierPathsForRange range:(208, 2)
requestsBoundingBezierPathsForRange range:(443, 3)
requestsPreviewForRect
prepareForTextAnimation range:(0, 1836)
prepareForTextAnimation range:(1836, 0)
finishTextAnimation range:(1836, 16396)
requestsPreviewForTextAnimation range:(1836, 16396)
requestsBoundingBezierPathsForRange range:(208, 2)
requestsBoundingBezierPathsForRange range:(443, 3)
prepareForTextAnimation range:(1836, 16396)
finishTextAnimation range:(0, 1836)
finishTextAnimation range:(0, 1836)
replaceRange proposedText:an range:(208, 2)
requestsUnderlinePathsForRange range:(208, 2)
requestsUnderlinePathsForRange range:(443, 3)
selectRanges ranges.count:1
requestsBoundingBezierPathsForRange range:(208, 2)
replaceRange proposedText:an range:(208, 2)
requestsUnderlinePathsForRange range:(208, 2)
requestsUnderlinePathsForRange range:(443, 3)
selectRanges ranges.count:1
replaceRange proposedText:you range:(443, 3)
requestsUnderlinePathsForRange range:(208, 2)
requestsUnderlinePathsForRange range:(443, 3)
selectRanges ranges.count:1
requestsBoundingBezierPathsForRange range:(443, 3)
replaceRange proposedText:you range:(443, 3)
requestsUnderlinePathsForRange range:(208, 2)
requestsUnderlinePathsForRange range:(443, 3)
selectRanges ranges.count:1
macOS version is 15.3.1 (24D70)