PinLayout icon indicating copy to clipboard operation
PinLayout copied to clipboard

Relative argument naming

Open mylesbarros opened this issue 5 years ago • 3 comments

Let me start by saying that PinLayout is a fantastic framework, thanks for working so hard on it!

Would it be possible to remove the argument names from the relative edge layout functions? Currently the English for most of them is incorrect. For example, left(of: ) and right(of: ) are perfect but the use of "of" in each function call in the first usage example,

view.pin.after(of: view4).before(of: view1).below(of: view3)

is grammatically incorrect.

Just a thought for readability. Thanks again for the existing work on this library!

mylesbarros avatar Apr 10 '19 16:04 mylesbarros

Hi @mylesbarros, your remark makes a lot of sense. I'm not a fan of unnecessary breaking change that would force all existing source code to be updated. Another option would be to duplicate these methods, but this, I think would create confusions. 🤔 🤔 🤔

The reason why the API always specify of is for consistency, so that all methods that reference another view use the of word. But this was maybe not a good idea.

I have to think about it. It would be nice to have access to a migration tool like Xcode has for Swift.

Anyone else has a remark about this?

lucdion avatar Apr 10 '19 17:04 lucdion

Thanks for the explanation, it does make sense in terms of having a consistent API so possibly that's useful for new developers even if it's distracting for others. 🙂

Overall though I would agree that it's probably not worth breaking the API for it unless you bundle it into a larger release.

mylesbarros avatar Apr 11 '19 16:04 mylesbarros

I noticed that, too, as the grammar used is very weird. @lucdion Perhaps duplicating the methods with deprecation warnings for the old ones?

philipbel avatar Mar 21 '21 14:03 philipbel

Very old topic. Closing it, sorry

lucdion avatar Mar 01 '23 20:03 lucdion