-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds new checkmark placeholder #125
Conversation
@@ -23,6 +23,10 @@ public struct Row: Hashable, Equatable { | |||
/// Checkmark | |||
case checkmark | |||
|
|||
/// Checkmark Placeholder. | |||
/// Allows spacing to continue to work when switching back & forth between checked states. | |||
case checkmarkPlaceholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this case necessary given:
https://github.com/venmo/Static/pull/125/files#diff-083b9db3d36d23083693e650c2604474R37
Allows for any view to be set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that we are probably running into this problem elsewhere in the app, and by resolving it here, we could solve it once for many places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given:
- disclosureIndicator
- checkmark
- switch
- customView
Each having different sizes
Would we also want a placeholder
for these as well should we not want text to fill the space in cells we were using those items as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if those are problematic for layout, we could certainly add those.
right now, I'm just trying to solve for the checkmark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal of Static is:
...to separate model data from presentation.
Row
s andSection
s are your “view models” for your cells.
If the Row
is the view model, does a value used solely for presentation belong there? To be sure, presentation has already crept into Row
, but we are adding to that with this addition.
I do agree that the convenience provided by this code is something that Static looks to provide. But I would like to see two things addressed:
- The magic number 24 (can we get that value from the image—although I know that it is nigh impossible)
- Providing placeholders for all cases as @dmiluski suggests, as I believe Static needs to be a complete solution for all use cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point of this PR is not to reimagine what Static is or is not, but to provide an easy way for a user to mark a cell for the potential to have a checkmark, so the rest of the content view is laid out appropriately.
24
was the result of testing this across various sized iPhones. I don't know of a way to predict this otherwise.
I don't have the time right now to add placeholders for every potential scenario – if that's a requirement for Static, I can kill this PR, and do a one-off solution in the venmo codebase.
thanks y'all
What do you think of handling this with a one-off |
@eliperkins I think this'll be useful for others who might want their content to not move around when showing a check or not showing a check. |
We were running into an issue where if you toggled back & forth between checked/unchecked states, the content would abruptly shift back & forth for the user, on smaller screens like the 5s. (The problem didn't exhibit itself on larger screens like the X).
This allows the developer to opt-in to use a
checkmarkPlaceholder
, allowing Static to insert a placeholder appropriately sized blankUIView
to hang out until a checkmark may appear in its place.