krzyzanowskim / Natalie

Natalie - Storyboard Code Generator (for Swift)
http://blog.krzyzanowskim.com/2015/04/15/natalie-storyboard-code-generator/
MIT License
1.17k stars 74 forks source link

add make and script #43

Closed kostiakoval closed 9 years ago

kostiakoval commented 9 years ago

I've splited Natalie.swift into 2 files:

Also there are 2 ways to merge them.

kostiakoval commented 9 years ago

@krzyzanowskim Hi, What do think about that idea?

phimage commented 9 years ago

I think I understand why you doing that. Xcode need a main.swift to compile codes at file scope, I didn't find a way to define natalie.swift as "main" To develop, I choose to create a "command line tool" project with a main.swift, remove the file, and make a symbolic link to /path/of/natalie.swift , so I can develop and launch it Maybe @krzyzanowskim could teach us what workflow he use to develop natalie.swift

I think If we cut files, we can go further and split in more files.

:warning: must not to merge if other PR exists

kostiakoval commented 9 years ago

But the "natalie.swift" contains exit(0) instruction and it's not available for usage in "command line" target

phimage commented 9 years ago

@kostiakoval you have a failure with exitor you read it somewhere? exit(0) compile and work for me in a main.swift if there is import Foundation (or Darwin)

kostiakoval commented 9 years ago

Ohh, import Foundation that I was missing, thanks

krzyzanowskim commented 9 years ago

I just added natalie.swift as external file to the sample project so you can easily build the project and edit natalie.swift from the Xcode.

kostiakoval commented 9 years ago

but you will not get any code completion

krzyzanowskim commented 9 years ago

The other way, I like actually, is quite straightforward (d02a599700b1f13d80ba5c4b9b78f06e73326608):

  1. Create project with command line target
  2. symlink main.swift to natalie.swift

so the trick is to compile natalie.swift as main.swift

Result combined from multiple files as @kostiakoval proposed is more sophisticated, but introduce learning curve for new contributors I'd like to avoid now.

PS. Side note about make solution: Xcode have targets of type "external build system", with make. So it would be good to have Xcode project that will generate final file. However... it's not working because Xcode wont parse (no autocompletion) file that is not compiled by the Xcode. Since this is script, so it is not compiled by default.