Hello! I didn’t realise this was here so had previously had help from @calvincestari on GitHub which has helped me get a step further but this seems like a better place to ask the next question.
At the moment I’m just trying to set up the StarWars schema into the project. Our project is set up in a very similar way to the Point Free isowords project… GitHub - pointfreeco/isowords: Open source game built in SwiftUI and the Composable Architecture.
We’re using a Package.swift
file to define all our modules and dependencies.
In there I have added a dependency…
.package(url: "https://github.com/apollographql/apollo-ios.git", .upToNextMajor(from: "1.0.0")),
And my target…
.target(
name: "GraphQL",
dependencies: [
.product(name: "Apollo", package: "apollo-ios"),
.product(name: "apollo-ios-cli", package: "apollo-ios"),
],
resources: [
.process("Resources"),
.process("Queries"),
]
),
And in the GraphQL
folder I have added the schema and query.
I’ve also updated the config file to make sure to have it pointing at the correct folders…
{
"schemaName" : "GraphQL",
"input" : {
"operationSearchPaths" : [
"./Sources/GraphQL/Queries/*.graphql"
],
"schemaSearchPaths" : [
"./Sources/GraphQL/Resources/*.graphql"
]
},
"output" : {
"testMocks" : {
"none" : {
}
},
"schemaTypes" : {
"path" : "./Sources/GraphQL/Types",
"moduleType" : {
"other" : {
}
}
},
"operations" : {
"relative" : {
}
}
}
}
Now when I right click on the Package and choose generate…
It generates the types and files for me…
image|300x446
If someone could embed this image it would help a lot. This is my first post so I can only embed one image. Thanks
However, now when I build the project I get a lot of errors throughout the project telling me Cannot find type 'ApolloCodegen' in scope
. But these errors are coming from the Apollo library files rather than the generated files.
I saw this error mentioned in another thread but in there it was mentioned that this was due to the sandbox mode when fetching the schema (I think). But I’m not doing that, just generating code.
Any help would be appreciated.
Thanks