RedMadRobot / figma-export

Command line utility to export colors, typography, icons and images from Figma to Xcode / Android Studio project
MIT License
718 stars 114 forks source link

Modify SwiftUI Color extension to extend ShapeStyle #185

Closed farkasseb closed 1 year ago

farkasseb commented 1 year ago

This change intends expand the usage of the generated SwiftUI color extension.

Color conforms to a bigger style called ShapeStyle and this allows us to use Colors, Gradients, Materials and more as if they were the same thing. This ShapeStyle protocol is what background uses. This allows us to use these colors everywhere SwiftUI expects a ShapeStyle to be given. https://www.hackingwithswift.com/books/ios-swiftui/formatting-our-mission-view

Additional discussion about the topic: https://www.hackingwithswift.com/forums/100-days-of-swiftui/extending-shapestyle-for-adding-colors-instead-of-extending-color/12324

I've found that I can create custom templates via templatesPath configuration but I still believe that defaulting to this would be better overall.

subdan commented 1 year ago

Thanks for the PR, @farkasseb!