SwiftGen / StencilSwiftKit

A framework bringing additional nodes & filters to Stencil dedicated to Swift code generation
MIT License
297 stars 58 forks source link

enhancement - consider leveraging this library for casing. #51

Closed johndpope closed 7 years ago

johndpope commented 7 years ago

https://github.com/uberbruns/CasingTools

why bother?

I was expecting the snakeToCamelCase to have a lower case letter for first. eg. func AccumulatorNumAccumulated()

->

func accumulatorNumAccumulated()

djbe commented 7 years ago

We try to avoid dependencies, especially if they are A) too new, or B) unmaintained.

Our filters might not match other implementations, that's why we have documentation about how they work: https://github.com/SwiftGen/StencilSwiftKit/blob/master/Documentation/filters-strings.md

We usually do something like value|snakeToCamelCase|lowerFirstWord in our templates (see https://github.com/SwiftGen/templates).

AliSoftware commented 7 years ago

Hi @johndpope

Thanks for the suggestion.

As @djbe said though, and after reviewing the library quickly, I don't think it's worth adding a dependency just for this kind of feature. Adding a dependency, especially one we don't have control over (contrary to Stencil and PathKit for which we work closely with the other and know he's active), might ends being a blocker if the dep isn't active, and is only worth it if it provides significant functionality that would be tedious to reproduce and maintain. This is not the case for our casing filters, especially also because we want the ones we use to be configurable, composable and fit for use in templates (so use |snakeToCamelCase|lowerFirstWord to compose filters), unlike the ones from that library that are strict and less composable.

So in conclusion, drawing a dependency only for those few filters doesn't seem worth it to me, and thus I'm closing the issue. Thanks for the suggestion though! 👍

johndpope commented 7 years ago

after actually using the function in template - it works well when chaining together.