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

Commit

Permalink
Merge pull request #74 from SwiftGen/feature/pretty-swiftidentifier
Browse files Browse the repository at this point in the history
Use the new "pretty" swiftIdentifier filter
  • Loading branch information
djbe authored Aug 20, 2017
2 parents 154dd2c + 58cb617 commit 9d8e706
Show file tree
Hide file tree
Showing 32 changed files with 184 additions and 136 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

### Bug Fixes

_None_
* Templates now use the "pretty" mode of the `swiftIdentifier` filter, fixing some issues with identifiers starting with a number.
[David Jennes](https://github.com/djbe)
[#74](https://github.com/SwiftGen/templates/pull/74)

### Breaking Changes

Expand Down
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PODS:
- PathKit (0.8.0)
- Stencil (0.9.0):
- PathKit (~> 0.8.0)
- StencilSwiftKit (2.0.1):
- StencilSwiftKit (2.1.0):
- Stencil (~> 0.9.0)

DEPENDENCIES:
Expand All @@ -15,13 +15,13 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
StencilSwiftKit:
:commit: 3ba083dea79a953156a3f128dcad0452f62a8132
:commit: fe1e940413b0aae34198f9465bbb34183c7aa0b2
:git: https://github.com/SwiftGen/StencilSwiftKit

SPEC CHECKSUMS:
PathKit: dcab05d701474011aae0e40cf892298a831f63d6
Stencil: 510f0b0518a366b67b6a9c5085a0399741b6d2f9
StencilSwiftKit: b7f4de5ecd88c484713883d83968da8b6cc3ff97
StencilSwiftKit: 76100a047f59c3358a3abe0cd5cc99db19a3dcc7

PODFILE CHECKSUM: 910aa7b4b6bcbe527b3b6800c8fe6bc374027140

Expand Down
4 changes: 2 additions & 2 deletions Pods/Local Podspecs/StencilSwiftKit.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Pods/StencilSwiftKit/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 56 additions & 22 deletions Pods/StencilSwiftKit/Sources/Filters+Strings.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 38 additions & 26 deletions Pods/StencilSwiftKit/Sources/SwiftIdentifier.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Pods/Target Support Files/StencilSwiftKit/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tests/Expected/Colors/swift2-context-multiple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct ColorName {
static let ArticleTitle = ColorName(rgbaValue: 0x33fe66ff)
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
static let Cyan_Color = ColorName(rgbaValue: 0xff66ccff)
static let CyanColor = ColorName(rgbaValue: 0xff66ccff)
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
static let NamedValue = ColorName(rgbaValue: 0xffffffcc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ enum XCTStoryboardsScene {

static let initialScene = InitialSceneType<CreateAccViewController>(Wizard.self)

static let Accept_CGU = SceneType<UIViewController>(Wizard.self, identifier: "Accept-CGU")
static let AcceptCGU = SceneType<UIViewController>(Wizard.self, identifier: "Accept-CGU")

static let CreateAccount = SceneType<CreateAccViewController>(Wizard.self, identifier: "CreateAccount")

static let Preferences = SceneType<UITableViewController>(Wizard.self, identifier: "Preferences")

static let Validate_Password = SceneType<UIViewController>(Wizard.self, identifier: "Validate_Password")
static let ValidatePassword = SceneType<UIViewController>(Wizard.self, identifier: "Validate_Password")
}
}

Expand All @@ -110,7 +110,7 @@ enum XCTStoryboardsSegue {
case CustomBack
case Embed
case NonCustom
case Show_NavCtrl = "Show-NavCtrl"
case ShowNavCtrl = "Show-NavCtrl"
}
enum Wizard: String, SegueType {
case ShowPassword
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ enum StoryboardScene {

static let initialScene = InitialSceneType<CreateAccViewController>(Wizard.self)

static let Accept_CGU = SceneType<UIViewController>(Wizard.self, identifier: "Accept-CGU")
static let AcceptCGU = SceneType<UIViewController>(Wizard.self, identifier: "Accept-CGU")

static let CreateAccount = SceneType<CreateAccViewController>(Wizard.self, identifier: "CreateAccount")

static let Preferences = SceneType<UITableViewController>(Wizard.self, identifier: "Preferences")

static let Validate_Password = SceneType<UIViewController>(Wizard.self, identifier: "Validate_Password")
static let ValidatePassword = SceneType<UIViewController>(Wizard.self, identifier: "Validate_Password")
}
}

Expand All @@ -109,7 +109,7 @@ enum StoryboardSegue {
case CustomBack
case Embed
case NonCustom
case Show_NavCtrl = "Show-NavCtrl"
case ShowNavCtrl = "Show-NavCtrl"
}
enum Wizard: String, SegueType {
case ShowPassword
Expand Down
6 changes: 3 additions & 3 deletions Tests/Expected/Storyboards-iOS/swift2-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ enum StoryboardScene {

static let initialScene = InitialSceneType<CreateAccViewController>(Wizard.self)

static let Accept_CGU = SceneType<UIViewController>(Wizard.self, identifier: "Accept-CGU")
static let AcceptCGU = SceneType<UIViewController>(Wizard.self, identifier: "Accept-CGU")

static let CreateAccount = SceneType<CreateAccViewController>(Wizard.self, identifier: "CreateAccount")

static let Preferences = SceneType<UITableViewController>(Wizard.self, identifier: "Preferences")

static let Validate_Password = SceneType<UIViewController>(Wizard.self, identifier: "Validate_Password")
static let ValidatePassword = SceneType<UIViewController>(Wizard.self, identifier: "Validate_Password")
}
}

Expand All @@ -110,7 +110,7 @@ enum StoryboardSegue {
case CustomBack
case Embed
case NonCustom
case Show_NavCtrl = "Show-NavCtrl"
case ShowNavCtrl = "Show-NavCtrl"
}
enum Wizard: String, SegueType {
case ShowPassword
Expand Down
4 changes: 2 additions & 2 deletions templates/colors/literals-swift3.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ extension {{enumName}} {
{% macro enumBlock colors sp %}
{{sp}} {% for color in colors %}
{{sp}} /// 0x{{color.red}}{{color.green}}{{color.blue}}{{color.alpha}} (r: {{color.red|hexToInt}}, g: {{color.green|hexToInt}}, b: {{color.blue|hexToInt}}, a: {{color.alpha|hexToInt}})
{{sp}} static let {{color.name|swiftIdentifier|snakeToCamelCase|lowerFirstWord|escapeReservedKeywords}} = #colorLiteral(red: {% call h2f color.red %}, green: {% call h2f color.green %}, blue: {% call h2f color.blue %}, alpha: {% call h2f color.alpha %})
{{sp}} static let {{color.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = #colorLiteral(red: {% call h2f color.red %}, green: {% call h2f color.green %}, blue: {% call h2f color.blue %}, alpha: {% call h2f color.alpha %})
{{sp}} {% endfor %}
{% endmacro %}
{% if palettes.count > 1 %}
{% for palette in palettes %}
enum {{palette.name|swiftIdentifier|titlecase|snakeToCamelCase|escapeReservedKeywords}} {
enum {{palette.name|swiftIdentifier:"pretty"|escapeReservedKeywords}} {
{% call enumBlock palette.colors " " %}
}
{% endfor %}
Expand Down
Loading

0 comments on commit 9d8e706

Please sign in to comment.