Here is what I discovered when using SwiftPM instead of Cocoapods and using new build approach.
When using -passthroughCustomScalars generating API.swift need to import Foundation for instance if using Swift Date type.
I could make a PR myself, just I couldn't understand where is the Swift template coming from?
I think I found how this can be solve and it is already a PR in https://github.com/apollographql/apollo-tooling/pull/1248
I'll work with the author of that PR to get it ready to go, but shouldn't Date as a custom scalar be your own date type and not Swift's?
@designatednerd I used this article so date from GraphQL types would go to Swift Date types. https://blog.apollographql.com/mapping-graphql-types-to-swift-aa85e5693db4
I think I'm missing something, I'm not seeing anything about Date or passthroughCustomScalars in there - @martijnwalraven (who wrote that), could you clarify a bit here about expected behavior?
You could use either your own Date type or Foundation.Date, but using the platform one is more common. I was operating under the naive assumption that Foundation would already be imported in your project, and the generated code would be part of your project, but the new build approach may have changed that (and it's not a very flexible approach regardless).
So in situations where the current passthroughCustomScalars behavior isn't working, you want to be able to specify a fully qualified type name. Maybe we could always generate a symbol import in that case, so import Foundation.Dateor import MyFramework.Date for example. That would avoid naming conflicts due to importing an entire module.
@designatednerd Sorry for late answer. Basically @martijnwalraven explained in his article how to map GraphQL types to Swift ones. So using -passthroughCustomScalars directive I was mapping GraphQL Date to Foundation.Date.
As @martijnwalraven explained using SwiftPM and new build system need to also import Foundation to use Swift types.
But I saw that https://github.com/apollographql/apollo-tooling/pull/1248 is moving forward and could help to solve this issue. 馃檹
Yep will poke the author on that if I don't hear from them today
This is shipping with 0.17.0
Shipped!
Thanks @designatednerd
I want to thank you again for all the hard work you do for this project and I love to see it active again! Thanks!