Bouke / SwiftInitializerGenerator

Xcode Source Code Extension to Generate Swift Initializers
MIT License
717 stars 31 forks source link

Does not work with playgrounds. #15

Open AtomicCat opened 7 years ago

AtomicCat commented 7 years ago

When run from a playground, I get the error Generate_Swift_Initializer.SIGError error 0. I assume this is SIGError.notSwiftLanguage. Maybe there is something special about the main source file in a playground...

Seems to work great in regular projects.

Bouke commented 6 years ago

In the SIGError enum the first case is notSwiftLanguage, which would probably be the 0 that you get. However in SourceEditorCommand.swift playgrounds are also valid: "com.apple.dt.playground". So your source type must be even something different. Can you step through the code and see what the value of invocation.buffer.contentUTI is?

karlpuusepp commented 6 years ago

@Bouke The contentUTI is "com.apple.dt.playgroundpage". This is not checked in SourceEditorCommand.swift.

Bouke commented 6 years ago

Ah, you're working with multiple pages, it seems? Can you create a PR to resolve this?