Skip to content

Throw an error when the provided path is not an asset catalog#217

Merged
djbe merged 3 commits intoSwiftGen:masterfrom
djbe:feature/catalog-folder-error
Dec 1, 2016
Merged

Throw an error when the provided path is not an asset catalog#217
djbe merged 3 commits intoSwiftGen:masterfrom
djbe:feature/catalog-folder-error

Conversation

@djbe
Copy link
Copy Markdown
Member

@djbe djbe commented Nov 29, 2016

Title says it all.

parser.parseCatalog(at: path)

switch path.extension {
case "xcassets"?:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wouldn't an if/else be more simple here instead of switch with only one case?

case "xcassets"?:
parser.parseCatalog(at: path)
default:
guard let `extension` = path.extension, `extension` == "xcassets" else {
Copy link
Copy Markdown
Collaborator

@AliSoftware AliSoftware Nov 29, 2016

Choose a reason for hiding this comment

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

Haha I was more thinking about guard case "xcassets"? = path.extension but that works too 😄

(I'm guessing a simple guard path.extension == "xcassets" doesn't work in Swift 3 since Optional<String> == String doesn't work directly?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ha, no, you're right, for some reason I automatically write unwrap code 😅

@kylef kylef mentioned this pull request Dec 1, 2016
@djbe djbe merged commit 4d23ed7 into SwiftGen:master Dec 1, 2016
@AliSoftware
Copy link
Copy Markdown
Collaborator

Oh is Travis starting to finally waking up? (So frustrating to wait for the CI so long!)

@djbe
Copy link
Copy Markdown
Member Author

djbe commented Dec 1, 2016

Yeah, they probably had an enormous backlog of jobs to get through.

@djbe djbe deleted the feature/catalog-folder-error branch December 1, 2016 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants