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

Import Foundation in codegen #1248

Merged
merged 2 commits into from
Oct 9, 2019
Merged

Import Foundation in codegen #1248

merged 2 commits into from
Oct 9, 2019

Conversation

dfed
Copy link
Contributor

@dfed dfed commented May 8, 2019

Hi folks! The Swift code-gen today requires that an Objective-C umbrella header be present that has an import <UIKit/UIKit.h> to compile. You can see this for yourself by running code-gen on any request/response that has a Date as a value or parameter. Date comes from Foundation, but there is no import of Foundation. Instead, the generated code implicitly relies on the UIKit import from an umbrella header to pull in Foundation.

This PR explicitly imports Foundation in the generated code, which allows consumers of Swift Apollo code-gen to no longer need an umbrella header.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

@apollo-cla
Copy link

@dfed: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@trevor-scheer
Copy link
Member

@designatednerd, would you mind taking a look at this when you get the chance? Thanks!

@trevor-scheer trevor-scheer requested review from designatednerd and removed request for jbaxleyiii and trevor-scheer July 12, 2019 18:21
@fassko
Copy link

fassko commented Oct 3, 2019

Would be great to get this forward. Thanks!

@designatednerd
Copy link
Contributor

@dfed Do you have a bit of time to rebase this, or do you mind if I take over this PR?

@dfed
Copy link
Contributor Author

dfed commented Oct 3, 2019

Happy to have you take this PR over the finish line @designatednerd! I’m out on vacation this week.

CHANGELOG.md Outdated
@@ -11,7 +11,7 @@
- `apollo-codegen-scala`
- <First `apollo-codegen-scala` related entry goes here>
- `apollo-codegen-swift`
- <First `apollo-codegen-swift` related entry goes here>
- Allow generated code to be compiled without a module umbrella header 1248](https://github.com/apollographql/apollo-tooling/pull/1248)
Copy link
Contributor

Choose a reason for hiding this comment

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

fwiw you don't need to put the link here

@designatednerd
Copy link
Contributor

OK cool - ping me when it's ready for another look

@designatednerd
Copy link
Contributor

🤦‍♀ Completely misread the earlier comment! Will take this over.

Copy link
Contributor

@designatednerd designatednerd left a comment

Choose a reason for hiding this comment

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

Works nicely in the test project - let's do this!

@designatednerd designatednerd merged commit c95e1a7 into apollographql:master Oct 9, 2019
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.

5 participants