Rect.reduce overload?


#1

I am finding myself using .reduce to help position components dynamically but there’s only one constructor which takes 2 args deltaX, deltaY and I am curious why there isn’t an overload that takes just one delta arg, like .reduced has? Although it’s a 2 second job to add in to my local I’m just continuing using 2 args case for now.


#2

There’s a reduced() method that takes one argument - you should use that.

As maybe I’ve mentioned before, I regret giving it a mutating reduce() method in retrospect - everyone should always prefer using the immutable reduced() methods instead of reduce().

I can’t quite justify deprecating the mutating methods (but am tempted…) however there’s certainly no way we’d add more mutating methods, so hopefully that answers your question of why this method seems to be missing!


#3

Kewl, it was no big. Just seemed a little inconsistent. I use reduce over reduced as it directly affects the class like .removeFromTop which are also quite handy little methods for positioning.