So, I've had this problem with swift since day 01. I've mentioned it a few times in these forums,a nd I haven't been able to get a satisfactory answer.
there's a lot of details, but it resolves to this:
a subclass, that overrides a superclass's method, never gets that overridden method called. Instead... The base class's method gets called.
earlier in the day, the subclass's method would be called just after launch of the debug, but following something I haven't tied down yet, the base class's method gets called.
So I have a base class : BKControlProps
it's got this method :
open func mouseDraggedBehavior(event : NSEvent, viewPt : CGPoint){}now there is a successive list of subclasses:
BKControlProps
BKScrollerProps
BKGroupProps
BKListProps
ScrollerProps overrides that mouseDraggedBehavior method:
open override func mouseDraggedBehavior(event : NSEvent, viewPt : CGPoint){
let minOffset : CGFloat = 0.0025
switch scrollValue {
case .none:
break
case .horiz:
deltaAggregate += 2 / self.xWorkingLength * event.deltaX
if abs(deltaAggregate) > minOffset{
self.xScrollAmnt += deltaAggregate
deltaAggregate = 0
}
case .vert:
deltaAggregate += 2 / self.yWorkingLength * event.deltaY
if abs(deltaAggregate) > minOffset{
self.yScrollAmnt += deltaAggregate
deltaAggregate = 0
}
}
}I have an instance of GroupProps, and an instance of ListProps. Niether one of them overrides the method in question.
when the method is called in the GroupProps class... the method override in ScrollerProps is the one that is called.
When the same method is called in the ListProps class... the method in the Base class is called. All of these classes are NSObject subclasses.
As I mentioned earlier, the behavior I am reporting is errattic at times. So it's a bug. It's a HUGE bug by my accounting. What I am wondering now... is how I control it? if inheritence is busted, there seems to be some kind of trigger. what is it? how do I avoid it?