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 for public class var #9

Closed
Vortec4800 opened this issue Mar 30, 2016 · 2 comments
Closed

Support for public class var #9

Vortec4800 opened this issue Mar 30, 2016 · 2 comments

Comments

@Vortec4800
Copy link

I'm trying to use this with PaintCode, which can export StyleKit classes that have colors. The only modification necessary to the PaintCode export file is to add the paletteName class func. I'm going to send an email to the PaintCode team to see if they might be able to add the paletteName func to their export template, but if not adding it manually isn't too difficult. As an aside, it would be cool if Crayons could detect a StyleKit file and index it with a standard name without needing the paletteName func.

Aside from that, PaintCode exports colors like this:

//// Cache

private struct Cache {
    static let themeRedColor: UIColor = UIColor(red: 0.835, green: 0.208, blue: 0.282, alpha: 1.000)
    static let themeGreenColor: UIColor = UIColor(red: 0.090, green: 0.592, blue: 0.467, alpha: 1.000)
    static let themeYellowColor: UIColor = UIColor(red: 0.965, green: 0.620, blue: 0.439, alpha: 1.000)
}

//// Colors

public class var themeRedColor: UIColor { return Cache.themeRedColor }
public class var themeGreenColor: UIColor { return Cache.themeGreenColor }
public class var themeYellowColor: UIColor { return Cache.themeYellowColor }

But Crayons needs this:

public class func testColor() -> UIColor { return Cache.themeGreenColor }

Is there a way to get Crayons to see these class vars and index them accordingly?

@Sephiroth87
Copy link
Owner

You got it :)
The only thing I can't do is automatically index StyleKit files, as they contain a generic NSObject and no recognisable feature (and the name can be anything).
Since I can't index every class that exposes colors, at this point the only way is to manually add the palette name to the class.

@Vortec4800
Copy link
Author

Hey cool, I'll update and check it out.

Shot in the dark about auto-indexing the files, adding the code manually isn't too much work.

Thanks!

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

No branches or pull requests

2 participants