Conversation
By changing the autoresize rules on the token label, we can force the label to appropriately size itself to the token title. Before, a token’s label was sized to its content, meaning that if it was actually longer than a line in the token field, it freely overflowed and was clipped by the outer VENToken’s view. I also exposed the line break mode for VENTokens as a whole, allowing a client application to change the line break mode to one appropriate to their data (breaking in the middle or beginning of the line, for example.
There was a problem hiding this comment.
Personal preference, but can we make this
@property (assign, nonatomic) NSLineBreakMode lineBreakMode;instead of a static variable?
There was a problem hiding this comment.
The reason I did it this way is so that it's consistent across VENToken instances. By scoping it statically, it avoids situations where some are breaking at the beginning and some at the end. Essentially, this is a class property rather than an instance property. If you would prefer it as an instance property though, I can convert it over and make sure it gets set on initialization.
There was a problem hiding this comment.
I prefer instance properties to avoid unintentional side-effects. At least in the Venmo app, we use VENTokenField in two separate places, and it could be the case that we want to use different line break styles for each (or at least have full control of its behavior in each context).
Let me know what you think, and thanks for the pull request! 😸
19b4b61 to
a0495aa
Compare
By changing the autoresize rules on the token label, we can force the
label to appropriately size itself to the token title. Before, a
token’s label was sized to its content, meaning that if it was actually
longer than a line in the token field, it freely overflowed and was
clipped by the outer VENToken’s view. I also exposed the line break
mode for VENTokens as a whole, allowing a client application to change
the line break mode to one appropriate to their data (breaking in the
middle or beginning of the line, for example). Including this in a release
requires a minor version as it adds new API.