Skip to content

Import Foundation in codegen#1248

Merged
designatednerd merged 2 commits intoapollographql:masterfrom
dfed:dfed--import
Oct 9, 2019
Merged

Import Foundation in codegen#1248
designatednerd merged 2 commits intoapollographql:masterfrom
dfed:dfed--import

Conversation

@dfed
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
Contributor

@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
Copy Markdown

fassko commented Oct 3, 2019

Would be great to get this forward. Thanks!

@designatednerd
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread CHANGELOG.md Outdated
- <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
Copy Markdown
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
Copy Markdown
Contributor

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

@designatednerd
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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