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

Deprecated variables #13

Merged
merged 13 commits into from
Apr 12, 2017
Merged

Deprecated variables #13

merged 13 commits into from
Apr 12, 2017

Conversation

djbe
Copy link
Member

@djbe djbe commented Feb 23, 2017

Implements #5
Works together with SwiftGen/templates#28.

@djbe djbe changed the title Feature/deprecated variables Deprecated variables Feb 23, 2017
@djbe djbe force-pushed the feature/deprecated-variables branch from c36d16e to 08313a5 Compare February 23, 2017 01:05

return [
"colors": colorMap,
"param": ["enumName": enumName],
Copy link
Contributor

Choose a reason for hiding this comment

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

The way SwiftGen's CLI inject command line --param x=y parameters means that this will be overridden by extra params, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does. I'm going to have to modify the param parser to merge context vars.

@AliSoftware
Copy link
Contributor

Ok I'm gonna trust you'll not forget to fix StencilSwiftKit to merge the params keys in the context other that that I think it's ready to merge… except if you want to merge the circle ci PR first (and rebase on top of it afterwards) to have a greener CI status on which we'd need more confident? 😉

@djbe
Copy link
Member Author

djbe commented Feb 28, 2017 via email

@djbe djbe force-pushed the feature/deprecated-variables branch from 04f244d to 00865b3 Compare March 5, 2017 16:37
@djbe
Copy link
Member Author

djbe commented Mar 24, 2017

@AliSoftware After SwiftGen/StencilSwiftKit#29 is merged, I can adapt this and SwiftGen/templates#28 if needed, and we can finally get this merged. The wiki page should be up to date, but I'll do another check to be sure.

if entry.types.count > 0 {
let params: [String: Any] = [
"types": entry.types.map { $0.rawValue },
result["parameters"] = entry.types.map { $0.rawValue }
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we shouldn't name this entry types or placeholderTypes instead of parameters. After all, that's more the list of types than a list of parameters. We call if parameters because we assume it's gonna be used to derive the parameters of an enum with associated values, but maybe not…

print("Error: \(error.localizedDescription)")
}

let result = parser.stencilContext(sceneEnumName: "XCTStoryboardsScene", segueEnumName: "XCTStoryboardsSegue")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use this PR to migrate stencilContext(sceneEnumName:, segueEnumName: ) to stencilContext(params: […]) instead, since the --sceneEnumName and --segueEnumName flags of swiftgen are also deprecated in favour of --param?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't think the parsers/generators would use parameters from CLI, or will they?

Copy link
Member Author

@djbe djbe Mar 27, 2017

Choose a reason for hiding this comment

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

For template stuff, such as enumName, these will be stored in params and don't affect SwiftGenKit. Should we have flags that change the generator's behaviour, I think we should have those as actual CLI documented flags/options (via Commander).

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmmh maybe I misunderstood, where is that stencilContext(sceneEnumName: segueEnumName: ) method defined, is it just a helper method for the tests here?

CHANGELOG.md Outdated
[David Jennes](https://github.com/djbe)
[#13](https://github.com/SwiftGen/SwiftGenKit/issues/13)
* For each string, the `params` variable and it's subvariables (such as `names`, `count`, ...) have been replaced by `parameters`, which is an array of types.
* The `strings`, `structuredStrings` and `tableName` have been replaced by `tables`, which is an array of string tables, each with a `name` and a `strings` property.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpicking but I find it more readable / logical to inverse the order of the first 2 bullet points. First talk top level, then talk about structure for each string.

@AliSoftware
Copy link
Contributor

Don't forget to update the comments (which summarise the structure of each context) as well as the documentation in documentation/Templates.md (even if it will probably evolve soon)

@djbe
Copy link
Member Author

djbe commented Mar 27, 2017

Sure, but quite a few of those (code comments) are really old (see images), so I'm nog going to bother documenting deprecated variables.

@AliSoftware
Copy link
Contributor

Indeed, not worth documenting deprecate variables (and forget again to update the comments when we remove them in 5.0 😄), but it's a while since they haven't been in sync so I figured it was a good occasion to do so

@djbe djbe mentioned this pull request Apr 2, 2017
18 tasks
@djbe
Copy link
Member Author

djbe commented Apr 12, 2017

Documentation has been updated (also in other repo's). I'm merging this now, we can always tweak things before release if needed.

@djbe djbe merged commit ad718be into master Apr 12, 2017
@djbe djbe deleted the feature/deprecated-variables branch April 12, 2017 13:08
@djbe djbe restored the feature/deprecated-variables branch April 12, 2017 13:08
@djbe djbe added this to the 1.1.0 milestone May 7, 2017
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