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

Allow to use strings filters on CustomStringConvertable #64

Closed
Antondomashnev opened this issue Aug 25, 2017 · 3 comments · Fixed by #65
Closed

Allow to use strings filters on CustomStringConvertable #64

Antondomashnev opened this issue Aug 25, 2017 · 3 comments · Fixed by #65

Comments

@Antondomashnev
Copy link
Contributor

This was proposed in #58. The idea is that at the moment all strings filters from Filters+Strings... expect String parameter and throw exception if it's not satisfied, however we could change this rule to accept all parameters that can be described as a string, which CustomStringConvertable is made for 😄

We'll also make use of it in Sourcery

@djbe
Copy link
Member

djbe commented Aug 25, 2017

Should be pretty easy to replace all casts to String with casts to StringConvertible, then add calls to String(describing:).

It could be interesting to refactor this out into it's own function, that way we can easily write tests for it and assure it works everywhere in exactly the same way. If at some point we want to add support for another type conversion to string, we can do it in that function.

@djbe
Copy link
Member

djbe commented Aug 25, 2017

Note: add it to https://github.com/SwiftGen/StencilSwiftKit/blob/master/Sources/Filters.swift, maybe as a parseString function.

@AliSoftware
Copy link
Contributor

I believe we already have a helper function called something similar to parseBoolParam or something for booleans, we should follow the same naming convention for strings and start grouping them in some helper namespace maybe?

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

Successfully merging a pull request may close this issue.

3 participants