I have an NSBox, and inside the NSBox is an NSImageView to display a placeholder picture. I have created a custom class, subclass of NSBox, and made it accept dragging for the files that i want. But when i drag over the NSImageView that is inside the NSBox, it exits the drag-area and i can't drop anything there.
I want to be able to tell both the NSBox and the NSImageView to use my dragging implementation so that i don't have to copy and paste code between two different classes.
I have not found a way to do this yet.
My understanding is that Categories can only extend a specific class, so that won't work.
And when testing Composition, I have not found anything that would work either.
And Posing is deprecated since long so i won't try that.
My thoughts are to create a class, subclass of NSView and put all con in that class implementation, and then try to inherit that class in my NSBox and NSImageView somehow. Like the following illustration (not actual code of course, just to illustrate what I am trying to do).
@interface MyClass : NSView <NSDraggingDestination>
@end
@interface MyClassBox : NSBox (Inherit implementation from MyClass)
@end
@interface MyClassImageView : NSImageView (Inherit implementation from MyClass)
@end