jordansinger / SwiftUI-Kit

A SwiftUI system components and interactions demo app
MIT License
2.35k stars 162 forks source link

Modeling #30

Open jordansinger opened 4 years ago

jordansinger commented 4 years ago

How should we be thinking about modeling the views, especially those that differ by platform and as the repo grows over time?

Could imagine the #if method getting messy.

As I was building this in the first place, I imagined making a struct to hold each grouping and an array of views inside of it. Curious if there are other suggestions and if doing this might be overkill?

ivanglushko commented 4 years ago

What if you were to use Modules for each platform? That way it won't be messy and shared code (views) can be shared and reused. But it needs a little hustle to implement.

Nef10 commented 4 years ago

I agree that we should have a better way than all this #if os() in the middle of the code.

We also should come up with a good way to handle the different modifiers. E.g. in the ProgressView has a CircularProgressViewStyle which we only show on watchOS, although it is available on all Platforms. We don't show it because on the other platforms it is the default style.