What do you think about using default values to en...
# android
What do you think about using default values to enable API users define vertical/horizontal dimensions but also specific sides?
Copy code
fun withMargins(
    @Px horizontal: Int = 0,
    @Px vertical: Int = 0,
    @Px start: Int = horizontal,
    @Px top: Int = vertical,
    @Px end: Int = horizontal,
    @Px bottom: Int = vertical
) {
 // Operation   
it seems like an abuse but it is convenient for the reader
I'd probably separate the method to support horizontal/vertical from explicit s, t, e, b
Then your horizontal/vertical method can just feed into the other values for s, t, e, b
I was thinking about supporting
horizontal = X, top = Y
, but I would need to see how often that happens
I like about your approach which is stricter and facilities the usage of symmetric dimensions
👍 1
Yep and if they want unsymmetrical dimensions you have the finer grained option available to them
You could also add another function which takes an
all: Int
👍 1