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

Commit

Permalink
Use enum's for namespacing instead of struct's. Fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
djbe committed Jan 15, 2017
1 parent 40cc780 commit b35d425
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Tests/Expected/Fonts/default-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension Font {
}
}

struct CustomFamily {
enum CustomFamily {
enum SFNSDisplay: String, FontConvertible {
case Black = ".SFNSDisplay-Black"
case Bold = ".SFNSDisplay-Bold"
Expand Down
2 changes: 1 addition & 1 deletion Tests/Expected/Fonts/default-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension Font {
}
}

struct FontFamily {
enum FontFamily {
enum SFNSDisplay: String, FontConvertible {
case Black = ".SFNSDisplay-Black"
case Bold = ".SFNSDisplay-Bold"
Expand Down
2 changes: 1 addition & 1 deletion Tests/Expected/Fonts/swift3-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension Font {
}
}

struct CustomFamily {
enum CustomFamily {
enum SFNSDisplay: String, FontConvertible {
case black = ".SFNSDisplay-Black"
case bold = ".SFNSDisplay-Bold"
Expand Down
2 changes: 1 addition & 1 deletion Tests/Expected/Fonts/swift3-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension Font {
}
}

struct FontFamily {
enum FontFamily {
enum SFNSDisplay: String, FontConvertible {
case black = ".SFNSDisplay-Black"
case bold = ".SFNSDisplay-Bold"
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-iOS/default-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum AdditionalImport: String, StoryboardSegueType {
case Test = "test"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum AdditionalImport: String, StoryboardSegueType {
case Test = "test"
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-iOS/lowercase-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum AdditionalImport: String, StoryboardSegueType {
case Test = "test"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum AdditionalImport: String, StoryboardSegueType {
case Test = "test"
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-iOS/swift3-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum AdditionalImport: String, StoryboardSegueType {
case test = "test"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum AdditionalImport: String, StoryboardSegueType {
case test = "test"
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-iOS/uppercase-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum AdditionalImport: String, StoryboardSegueType {
case Test = "test"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension UIViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -169,7 +169,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum AdditionalImport: String, StoryboardSegueType {
case Test = "test"
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-macOS/default-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NSViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -157,7 +157,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum Message: String, StoryboardSegueType {
case Custom = "Custom"
case Embed = "Embed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NSViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -157,7 +157,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum Message: String, StoryboardSegueType {
case Custom = "Custom"
case Embed = "Embed"
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-macOS/lowercase-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NSViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -157,7 +157,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum Message: String, StoryboardSegueType {
case Custom = "Custom"
case Embed = "Embed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NSViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -157,7 +157,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum Message: String, StoryboardSegueType {
case Custom = "Custom"
case Embed = "Embed"
Expand Down
4 changes: 2 additions & 2 deletions Tests/Expected/Storyboards-macOS/swift3-context-all.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NSViewController {
}
}

struct StoryboardScene {
enum StoryboardScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -157,7 +157,7 @@ struct StoryboardScene {
}
}

struct StoryboardSegue {
enum StoryboardSegue {
enum Message: String, StoryboardSegueType {
case custom = "Custom"
case embed = "Embed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension NSViewController {
}
}

struct XCTStoryboardsScene {
enum XCTStoryboardsScene {
enum AdditionalImport: String, StoryboardSceneType {
static let storyboardName = "AdditionalImport"

Expand Down Expand Up @@ -157,7 +157,7 @@ struct XCTStoryboardsScene {
}
}

struct XCTStoryboardsSegue {
enum XCTStoryboardsSegue {
enum Message: String, StoryboardSegueType {
case custom = "Custom"
case embed = "Embed"
Expand Down
2 changes: 1 addition & 1 deletion templates/fonts-default.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension Font {
}
}

struct {{enumName}} {
enum {{enumName}} {
{% for family in families %}
enum {{family.name|swiftIdentifier|snakeToCamelCaseNoPrefix}}: String, FontConvertible {
{% for font in family.fonts %}
Expand Down
2 changes: 1 addition & 1 deletion templates/fonts-swift3.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension Font {
}
}

struct {{enumName}} {
enum {{enumName}} {
{% for family in families %}
enum {{family.name|swiftIdentifier|snakeToCamelCaseNoPrefix}}: String, FontConvertible {
{% for font in family.fonts %}
Expand Down
4 changes: 2 additions & 2 deletions templates/storyboards-default.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension UIViewController {

{# This is where the generation begins, this code depends on what you have in your Storyboards #}
{% if storyboards %}
struct {{sceneEnumName}} {
enum {{sceneEnumName}} {
{% for storyboard in storyboards %}
{% set storyboardName %}{{storyboard.name|swiftIdentifier}}{% endset %}
{% if storyboard.scenes %}
Expand Down Expand Up @@ -110,7 +110,7 @@ struct {{sceneEnumName}} {
{% endfor %}
}

struct {{segueEnumName}} {
enum {{segueEnumName}} {
{% for storyboard in storyboards %}{% if storyboard.segues %}
enum {{storyboard.name|swiftIdentifier}}: String, StoryboardSegueType {
{% for segue in storyboard.segues %}
Expand Down
4 changes: 2 additions & 2 deletions templates/storyboards-lowercase.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extension UIViewController {

{# This is where the generation begins, this code depends on what you have in your Storyboards #}
{% if storyboards %}
struct {{sceneEnumName}} {
enum {{sceneEnumName}} {
{% for storyboard in storyboards %}
{% set storyboardName %}{{storyboard.name|swiftIdentifier}}{% endset %}
{% if storyboard.scenes %}
Expand Down Expand Up @@ -110,7 +110,7 @@ struct {{sceneEnumName}} {
{% endfor %}
}

struct {{segueEnumName}} {
enum {{segueEnumName}} {
{% for storyboard in storyboards %}{% if storyboard.segues %}
enum {{storyboard.name|swiftIdentifier}}: String, StoryboardSegueType {
{% for segue in storyboard.segues %}
Expand Down
4 changes: 2 additions & 2 deletions templates/storyboards-osx-default.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension NSViewController {

{# This is where the generation begins, this code depends on what you have in your Storyboards #}
{% if storyboards %}
struct {{sceneEnumName}} {
enum {{sceneEnumName}} {
{% for storyboard in storyboards %}
{% set storyboardName %}{{storyboard.name|swiftIdentifier}}{% endset %}
{% if storyboard.scenes %}
Expand Down Expand Up @@ -91,7 +91,7 @@ struct {{sceneEnumName}} {
{% endfor %}
}

struct {{segueEnumName}} {
enum {{segueEnumName}} {
{% for storyboard in storyboards %}{% if storyboard.segues %}
enum {{storyboard.name|swiftIdentifier}}: String, StoryboardSegueType {
{% for segue in storyboard.segues %}
Expand Down
4 changes: 2 additions & 2 deletions templates/storyboards-osx-lowercase.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension NSViewController {

{# This is where the generation begins, this code depends on what you have in your Storyboards #}
{% if storyboards %}
struct {{sceneEnumName}} {
enum {{sceneEnumName}} {
{% for storyboard in storyboards %}
{% set storyboardName %}{{storyboard.name|swiftIdentifier}}{% endset %}
{% if storyboard.scenes %}
Expand Down Expand Up @@ -91,7 +91,7 @@ struct {{sceneEnumName}} {
{% endfor %}
}

struct {{segueEnumName}} {
enum {{segueEnumName}} {
{% for storyboard in storyboards %}{% if storyboard.segues %}
enum {{storyboard.name|swiftIdentifier}}: String, StoryboardSegueType {
{% for segue in storyboard.segues %}
Expand Down
4 changes: 2 additions & 2 deletions templates/storyboards-osx-swift3.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension NSViewController {

{# This is where the generation begins, this code depends on what you have in your Storyboards #}
{% if storyboards %}
struct {{sceneEnumName}} {
enum {{sceneEnumName}} {
{% for storyboard in storyboards %}
{% set storyboardName %}{{storyboard.name|swiftIdentifier}}{% endset %}
{% if storyboard.scenes %}
Expand Down Expand Up @@ -91,7 +91,7 @@ struct {{sceneEnumName}} {
{% endfor %}
}

struct {{segueEnumName}} {
enum {{segueEnumName}} {
{% for storyboard in storyboards %}{% if storyboard.segues %}
enum {{storyboard.name|swiftIdentifier}}: String, StoryboardSegueType {
{% for segue in storyboard.segues %}
Expand Down
Loading

0 comments on commit b35d425

Please sign in to comment.