I was wondering why `Modifier.swipeable` is part o...
# compose
s
I was wondering why
Modifier.swipeable
is part of
compose-material
, is there a specific reason? (I mean, it may be useful to non material design users - it also doesn't depend on any MD specific item, of course)
e
My guess is that swipeable is a mobile pattern/Android. So from a foundation standpoint, only shared gestures or modifiers should be in the foundation. something like swipeable maybe wouldnt make sense in a Desktop Compose. vs Clickable, which is part of foudnation, is a platform agnostic gesture
j
Swipeable is opinionated - i.e. about resistance and (dynamic) thresholds. These are specific to the way motion works in Material. Swipeable was originally created for Material, and moving things into Foundation requires adapting the APIs to be generic and cover more use cases than just Material. Currently, Swipeable's API and design need another iteration though. After having a nice API, it would be quite nice to have a Foundation version. Do you have a use case where you don't want to depend on Material (say you're building your own design system) but still need Swipeable?
👍 3
Fwiw Swipeable isn't Android-specific🙂
e
Thanks for the insight Jossi
s
Do you have a use case where you don't want to depend on Material (say you're building your own design system) but still need Swipeable?
That's it, I'd like to use
swipeable
in my own
Drawer
(and probably many other components, in the future) - it would save a lot of lines of code
👍 1
j
@matvei loooook here are people to support our case!
j
I am not depending on material so I have copied it
👍 2
m
why copy it? why not just bring in material and let the r8 take care of removing anything you’re not using? I always shy away from copying code personally unless i have to make modifications to it (an example being our switches, radiobuttons and checkboxes which can’t be produced according our internal design system with the existing functions)
j
because I have a custom design system which doesnt expose any material component
m
Good to know you all are waiting for this. WE have this feature filed for a while (https://issuetracker.google.com/issues/174241799) and I agree that it would be beneficial to have it in a separate module, even if it is under material module group (TBD). I don't have any updates on the work in this regard, but feel free to +1 the ticket to follow it