Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Use the new "pretty" swiftIdentifier filter #74

Merged
merged 5 commits into from
Aug 20, 2017

Conversation

djbe
Copy link
Member

@djbe djbe commented Aug 19, 2017

Fixes SwiftGen/SwiftGen#289
Applies new filter from SwiftGen/StencilSwiftKit#61

  • Update podfile to point to StencilSwiftKit master.

Podfile Outdated
@@ -3,7 +3,7 @@ use_frameworks!

def common_pods
pod 'Stencil', :inhibit_warnings => true
pod 'StencilSwiftKit', :git => 'https://github.com/SwiftGen/StencilSwiftKit'
pod 'StencilSwiftKit', :git => 'https://github.com/SwiftGen/StencilSwiftKit', :branch => 'feature/pretty-swiftidentifier'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 💭 Reminder to restore after related branch merge

@@ -109,7 +109,7 @@ enum StoryboardSegue {
case CustomBack
case Embed
case NonCustom
case Show_NavCtrl = "Show-NavCtrl"
case ShowNavCtrl = "Show-NavCtrl"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean that the next release is gonna be breaking?
I'm OK with that — the change is good here — but we'll have to wonder if that should mean bumping SwiftGen to major for that too…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, these are all swift 2 changes, which we don't support. I wouldn't bump the version for it.

{{sp}} {% endfor %}
{% endmacro %}
{% if palettes.count > 1 %}
{% for palette in palettes %}
enum {{palette.name|swiftIdentifier|titlecase|snakeToCamelCase|escapeReservedKeywords}} {
enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if escaping reserved Swift keywords shouldn't also be a role for swiftIdentifier, as that filter is supposed to make any string into a valid Swift identifier, and private isn't valid for an identifier, so…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be more difficult, because stuff can happen with the string between swiftIdentifier and escapeReservedKeywords. For example, all swift 3 identifiers that start lowercased will be:
|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is also a reason why I don't like swiftIdentifier to uppercase the first letter 😉
e.g. iOSModel --[swiftIdentifier]--> IOSModel --[lowerFirstWord]--> iosModel 😉

But that's a different debate I guess ^^

@djbe djbe force-pushed the feature/pretty-swiftidentifier branch from e891a93 to 35c42f5 Compare August 20, 2017 16:17
@djbe djbe added this to the 2.1.0 milestone Aug 20, 2017
@djbe djbe merged commit 9d8e706 into master Aug 20, 2017
@djbe djbe deleted the feature/pretty-swiftidentifier branch August 20, 2017 17:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants