-
Notifications
You must be signed in to change notification settings - Fork 38
Adding a param
to customize the access modifier (supersedes #81)
#84
Conversation
Just nitpicking: |
Good point, what about |
Yeah, sounds good. |
c68afdd
to
811b13b
Compare
811b13b
to
55c47eb
Compare
Unrelated to this PR (but noticed it while reviewing): We still generate all the variations for swift 2, even though we don't compile these afterwards. Is it worth it keeping those around, and still generating them? They're marked as deprecated in the documentation.
It might be worth it, for unsupported swift versions, to not generate the variations and only have the default output. |
Tbh in even wonder if it's worth keeping Swift 2 templates at all… |
@@ -2,19 +2,20 @@ | |||
|
|||
{% if palettes %} | |||
{% set enumName %}{{param.enumName|default:"ColorName"}}{% endset %} | |||
{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: although it's not necessary to mark these as internal
per se, I think it's good to actually do it, as it clearly communicates this to the user/developer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's why I took that approach instead of the one in #81 where it was either public
when on… and empty string when off.
I prefer the current approach both for balance in the template (as including the space in one case and nothing in the other and not having the space when using {{accessModifier}}func
feels strange) and because making internal explicit feels more… well… explicit 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Up to Xcode 8, you can use swift 2.3. I don't think anyone still uses it, and if they still do, they really should migrate. And if they really want, they can always use a custom template based on the current ones. But I vote remove them 👍 (separate PR though) |
Yeah that was my thought too. They can always use the templates as custom templates after making a copy of ours from the commit before we remove them 😜 |
Closes #81
This is a follow-up of #81 which seemed to be a little bit abandoned by @txaiwieser
I used a little different take (just using
--param public
, as there's no practical use to make the constants something other thanpublic
orinternal
— generatingprivate
orfile private
constants would be useless) hence the separate PR.