Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to integrate SwiftGen into .xcodeproj #59

Closed
mman opened this issue Nov 10, 2015 · 8 comments
Closed

Document how to integrate SwiftGen into .xcodeproj #59

mman opened this issue Nov 10, 2015 · 8 comments

Comments

@mman
Copy link

mman commented Nov 10, 2015

I'd like to integrate swiftgen directly into my xcode project file so that it's invoked automatically on each build so that all generated files are always up to date.

Could you please provide an example how to do it properly in README

thanks,
Martin

@AliSoftware
Copy link
Collaborator

Hi Martin,

This would probably be as simple as adding a "Script Build Phase" in your target settings which invokes the swiftgen commands from there. Simple as that.


As regard to documenting that in the README, I don't think that's the right place:

  • The README is pretty big already
  • This is more a documentation related to Xcode (that trick works for anything, not just SwiftGen)
  • It could still be interesting to document, for the specific use case of SwiftGen, but I believe each project and people will have different contexts and solutions for that, like some people wanting to do that on their CI instead of locally, etc, so this could turn into a quite big paragraph for the README

So I think an entry in the Wiki could be more appropriate. That way people could also easily share their experience and add other solutions they found useful for different use cases for example.

I encourage you to create a simple wiki page there (you should have access to edit the wiki I think) and document that (probably with some captures) once you've configured it successfully on your project. That'll be probably as simple as what the Apple documentation I linked above says, but maybe with a screenshot including the script with the swiftgen calls).

I also know that @jschmid is using it on his CircleCI builds to ensure that developers did not forget to regenerate the files if needed. That's a different but interesting approach too, which he may also be interested to help you document in that wiki page.

@vkaramov
Copy link

@ivanbruel
Copy link

Just to provide a quick example for people looking into this (based on how swiftlint does it)

Add a run script phase and paste:

if which swiftgen >/dev/null; then
swiftgen storyboards <Project Name> --output <Project Name>/Resources/Storyboards.swift
else
echo "SwiftGen does not exist, download from https://github.com/AliSoftware/SwiftGen"
fi

@jschmid
Copy link

jschmid commented Nov 12, 2015

I added a wiki page about continuous integration.
Feel free to update it !

@mman
Copy link
Author

mman commented Nov 12, 2015

Thanks guys for your help,
Martin

@AliSoftware
Copy link
Collaborator

@jschmid Thx!

@mman Do you think we can close the issue or do you want to wait until you add more info to the wiki page @jschmid started?

@AliSoftware
Copy link
Collaborator

Note that you can also check what @MrAlek did in #64 (comment) to integrate SwiftGen to their Xcode project using a Build Phase like other suggested here; the capture he posted might give you some more pointers.

@AliSoftware
Copy link
Collaborator

I added a dedicated wiki page here. Feel free to improve it. I'm closing this issue now 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants