I make SnapOperationQueue which is an operation queue with a few extensions I like. One of them is reprioritisation of groups of operations. An operation is added with one of these four priorities (SnapOperationQueuePriority):
case Highest
case High
case Normal
case Low
In the current implementation I have it so that .Low and .Highest will not change, but .High and .Normal will.
I would like to change this so that I can have upper and lower thresholds on priorities. I.e, I can say that this operation that we might as well do now (.Low) can become super-important in a bit (.High) i.e. when pre-caching images and that image is all the sudden needed on screen. These thresholds should also be able to say that some operations, even in a group that is reprioritised, will not be reprioritised lower than something, i.e. a login operation (.Highest) should remain .Highest
To do this, I wanted to modify my enum like this:
case Highest(lowerThreshold: SnapOperationQueuePriority = .Highest)
case High(lowerThreshold: SnapOperationQueuePriority = .Low, higherThreshold: SnapOperationQueuePriority = .High)
case Normal(lowerThreshold: SnapOperationQueuePriority = .Low, higherThreshold: SnapOperationQueuePriority = .High)
case Low(higherThreshold: SnapOperationQueuePriority = .Low)
However, I get "Default argument not permitted in a touple type". The reason I want to have default arguments here is so that this change won't break or change behaviour of any code that is already using the existing implementation.
Can you suggest a way in which I can get my new priorities yet don't change the API for code that depends on the current API?