-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/segmented picker animation #10
Conversation
This is very minor, but did you consider adding dividers between the segments? |
I'm also unable to get colorScheme to work. I'll create an issue for that. |
Yeah, I did consider this. I actually put it off and kind of forgot about it. The reason I originally didn't add it was because the logic was a bit strange before I was manipulating the view outside of the |
Finished implemntation. |
BetterPickerStyle
that mimics SwiftUIPickerStyle.segmented
Explanation for changes made outside of
SegmentedBetterPickerStyle
BetterPickerStyleListCellConfiguration.select
anddeselect
were made public. The reasoning for this was that with a.segmented
style, it does not necessarily make sense to "toggle" when selecting. These normally have a default value selected to start and do not allow for a case where nothing is selected.selectionIndexSet
toBetterPickerStyleConfiguration
. This was needed because of the way we needed to handle the UI. We need to know which selection is chosen in order to move theView
that displays the selection. We have to do this outside of themakeListCell
since we want theView
to animate between cells when changing our selection.Explanation of some decisions made for
SegmentedBetterPickerStyle
BetterPickerStyle
. I tried doing this usingGeometryReader
, but that also requires a width or it will expand to the entire parentView
(not ideal). It would be great ifSegmentedBetterPickerStyle
had an optionalframeWidth
, and if that value wasnil
it would auto-size. I could not get that working though.@Environment(\.colorScheme) var colorScheme
was not working properly for me. Maybe I was doing something wrong, but it was not changing based on the selected Color Scheme in Previewer. While not optimal, everything is still very much usable in both light and dark modes.frameWidth
,frameHeight
andhorizontalCellAlignment
. My thought was that these would be nice to modify at the parent level. Any cell-based styling should be able to be handled via theItemContent
. Let me know if there are more configurable style options you'd like to see.