fernandodelrio / swiftcolorgen Goto Github PK
View Code? Open in Web Editor NEWA tool that generate code for Swift projects, designed to improve the maintainability of UIColors
License: MIT License
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors
License: MIT License
I would prefer seeing the generated colours added as computed properties, as we are simply accessing a defined value of a particular type - and not doing any functional computation or state changing.
Two of the colors that got generated for my project were invalid/didn't compile:
/// Color #FF0000 (alpha 217)
class func genFF0000 (alpha 217)() -> UIColor {
return UIColor(named: "FF0000 (alpha 217)") ?? UIColor.white
}
/// Color #E00000 (alpha 217)
class func genE00000 (alpha 217)() -> UIColor {
return UIColor(named: "E00000 (alpha 217)") ?? UIColor.white
}
Let me know what else would be helpful to debug
Sometimes when assigning a Named Color inside the storyboard, Xcode adds a duplicated entry for the same namedColor in the storyboard's xml. This can be easily seen, even without using this tool, just start assigning the same Named Color to different places, and you should see the duplicated entry in the xml.
If you re-open the interface builder, Xcode should display a warning about that and then it will remove the duplicated entry. I found an open radar for that: https://openradar.appspot.com/35172913
If we run SwiftColorGen, it will not remove the duplicated entry and when the Interface Builder reloads, the user will have the false impression, the tool introduced an error.
Considering that, a enhancement can be made:
Everytime SwiftGen runs, it should ensure there's no duplicates in the namedColor keys in the storyboard xml's.
The storyboard's XML is read, modified and then rewritten. The order of the tag's properties will probably change every time (AEXML won't keep the original order). This is bad considering that a diff will accuse a whole file difference on all storyboards, making a Code Review harder.
Need to check if it's possible to rewrite the storyboard with the minimum of changes (with the diff only accusing the real changes made)
Everything works fine if using the sRGB color space there, but other color spaces fails. The tool is ready to work with any color space but, this is not implemented on the Asset catalog itself.
Just need to ensure, the values are persisted in sRGB converting from other color spaces (as done in the other places)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.