Skip to content
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

Support Named Colors in Asset Catalogs #315

Closed
Jeehut opened this issue Jun 10, 2017 · 1 comment
Closed

Support Named Colors in Asset Catalogs #315

Jeehut opened this issue Jun 10, 2017 · 1 comment

Comments

@Jeehut
Copy link
Collaborator

Jeehut commented Jun 10, 2017

Currently when you want to define colors, you need to manually add a file like a Colors.txt to the project and specify that with the SwiftGen Colors command.

Now that Xcode 9 is adding support for named colors within .xcassets SwiftGen should do the same it already does for images now for colors, too: Extract the names of the colors from the assets and add them to the generated Swift file. The assets will probably be the place most iOS developers are going to put there color to anyways, so this feature should be naturally adopted by SwiftGen in my opinion.

@djbe djbe added this to the 5.1.0 milestone Jun 11, 2017
@AliSoftware
Copy link
Collaborator

AliSoftware commented Aug 13, 2017

We plan to add that as soon as in the next release 👍
Any help welcome, shouldn't be too much work, just parsing the additional keys in the AssetsCatalogParser and update the templates accordingly


Only thing I'm wondering is if we're gonna have too complicated template variants, e.g. for people wanting to choose some custom output for their images constants but some other custom output for their color constants for the generated code. As all all be in a single template for everything generated from .xcassets, we could end up wth xcassets/flat-swift3.stencil + xcassets/structured-swift3.stencil + xcassets/structuredimages-flatcolors-swift3.stencil + xcassets/flatimages-structuredcolors-swift3.stencil … quite a mess.

I don't think that's gonna be a real problem in practice, as for now we don't have many variants neither for images nor colors (only swift 2/3/4 variants but not flat vs structured), but would be nice if we could make it flexible (using Stencil's {% include %} tags maybe to split that template in 2 ? But is this really worth it? Open to discussion)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants