I am subclassing my UIView class. The Xcode (I am using 4.6.3) auto generated code says,
/*
// Only override drawRect: if you perform custom drawing
Only override draw() if you perform custom drawing.
This means if we do not perform custom drawing, we should not write the overriding function. The "default" draw() is used. All graphics, if any, are handled "natively" so performance is best optimsed.
An empty implementation adversely affects performance during animation.
If we do override draw(), but we do not write any code in the function leaving this func empty, that is (1) an implementation of override draw() and it is also (2) an empty one as well. This will degrade performance. The following code
public override func (_ r: CGRect) {
// empty
}
is not efficient during animation. Persumably the system will attempt to redraw the whole canvas rather than redrawing only the affected part?