flowkey / UIKit-cross-platform

Cross-platform Swift implementation of UIKit, mostly for Android
MIT License
594 stars 40 forks source link

Implement basic Switch #351

Closed rikner closed 2 years ago

rikner commented 2 years ago

Fixes #

Type of change:

Motivation (current vs expected behavior)

This is a minimal implementation for a UISwitch-like component

Resources: https://material.io/develop/android/components/switches

Jan-07-2022 15-28-50

now with thumb having a shadow: switch

Please check if the PR fulfills these requirements

michaelknoch commented 2 years ago

it seems that the switch is invisible on first render and has to be clicked once to make it visible @rikner https://beta.record.wtf/play?id=1641471935790_47345

rikner commented 2 years ago

it seems that the switch is invisible on first render and has to be clicked once to make it visible @rikner https://beta.record.wtf/play?id=1641471935790_47345

thx for the hint. fixed it 👍

mouselangelo commented 2 years ago

Hey @rikner - sorry I never got around to reviewing this! I had reviewed the code and wanted to test this locally but just didn't get around to doing that! The implementation looks great though. Thanks 🙏

I am wondering if adding this to the samples/getting-started app, like we did for alerts UI would have made it easier to test. I also like the idea of being able to preview all the components and test them.

I'd even suggest implementing a new samples/storybook or samples/showcase project - to keep getting-started very simple. We could implement something similar to storybook (not as advanced but simpler), purely using UIKit. We use storybook in our harmony design system and it's very useful to browse through the various core styles and components.

I'd be happy to support with this. @michaelknoch @ephemer - what do you guys think?