API.swift file not update : Apollo GraphQL iOS











up vote
2
down vote

favorite












I am using GraphQL API with iOS project.my .graphql file is,



mutation SigninQuery($email: String! , $password: String!) {
signin(email: $email, password: $password) {
result {
token
firstName
lastName
profileImage
}
}
}


and my files are located in the following order,



Project




  • ->appDelegate

  • ->info.plist

  • ->schema.json

  • -->Graphql[Folder]


  • ->API.swift


  • ->ApiFile.graphql



My API.swift file still exist only with header




import Apollo




. Anyone can you please help me to findout the solution










share|improve this question




















  • 1




    1. Update your schema.json before build. 2. Build normally in XCode (if you attach shell script for running GraphQL parser). It should update the file API.swift. According to your GraphQL file, you should be able to call the class with name SigninQueryMutation(email: , password:)
    – Cosmos Man
    Nov 12 at 7:29












  • @CosmosMan Thank you for your reply but can you please explain me how to update schema.json file...
    – Angel F Syrus
    Nov 12 at 8:28






  • 1




    What I actually mean by update is to regenerate the schema.json. I think some script is missing in your XCode build phase. How graphql works is, 1. You inspect graphql schema and generate it as schema.json or some_other_name.json. 2. Then feed that schema.json or some_other_name.json to your graphql parser to parse your .graphql files. If something missed between schema.json and .graphql files, it won't work. Something like isUserPretty is missing from user. If nothing happened, it should be working fine.
    – Cosmos Man
    Nov 12 at 8:29










  • For example, a script for generating schema.json look like this. apollo-codegen introspect-schema http://www.your-server:8080/graphql --header "Authorization: Bearer some kind of authorization code" --output schema.json.
    – Cosmos Man
    Nov 12 at 8:32






  • 1




    a script for generating API.swift looks like this. APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)" if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project." exit 1 fi cd "${SRCROOT}/${TARGET_NAME}" $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
    – Cosmos Man
    Nov 12 at 8:33

















up vote
2
down vote

favorite












I am using GraphQL API with iOS project.my .graphql file is,



mutation SigninQuery($email: String! , $password: String!) {
signin(email: $email, password: $password) {
result {
token
firstName
lastName
profileImage
}
}
}


and my files are located in the following order,



Project




  • ->appDelegate

  • ->info.plist

  • ->schema.json

  • -->Graphql[Folder]


  • ->API.swift


  • ->ApiFile.graphql



My API.swift file still exist only with header




import Apollo




. Anyone can you please help me to findout the solution










share|improve this question




















  • 1




    1. Update your schema.json before build. 2. Build normally in XCode (if you attach shell script for running GraphQL parser). It should update the file API.swift. According to your GraphQL file, you should be able to call the class with name SigninQueryMutation(email: , password:)
    – Cosmos Man
    Nov 12 at 7:29












  • @CosmosMan Thank you for your reply but can you please explain me how to update schema.json file...
    – Angel F Syrus
    Nov 12 at 8:28






  • 1




    What I actually mean by update is to regenerate the schema.json. I think some script is missing in your XCode build phase. How graphql works is, 1. You inspect graphql schema and generate it as schema.json or some_other_name.json. 2. Then feed that schema.json or some_other_name.json to your graphql parser to parse your .graphql files. If something missed between schema.json and .graphql files, it won't work. Something like isUserPretty is missing from user. If nothing happened, it should be working fine.
    – Cosmos Man
    Nov 12 at 8:29










  • For example, a script for generating schema.json look like this. apollo-codegen introspect-schema http://www.your-server:8080/graphql --header "Authorization: Bearer some kind of authorization code" --output schema.json.
    – Cosmos Man
    Nov 12 at 8:32






  • 1




    a script for generating API.swift looks like this. APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)" if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project." exit 1 fi cd "${SRCROOT}/${TARGET_NAME}" $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
    – Cosmos Man
    Nov 12 at 8:33















up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am using GraphQL API with iOS project.my .graphql file is,



mutation SigninQuery($email: String! , $password: String!) {
signin(email: $email, password: $password) {
result {
token
firstName
lastName
profileImage
}
}
}


and my files are located in the following order,



Project




  • ->appDelegate

  • ->info.plist

  • ->schema.json

  • -->Graphql[Folder]


  • ->API.swift


  • ->ApiFile.graphql



My API.swift file still exist only with header




import Apollo




. Anyone can you please help me to findout the solution










share|improve this question















I am using GraphQL API with iOS project.my .graphql file is,



mutation SigninQuery($email: String! , $password: String!) {
signin(email: $email, password: $password) {
result {
token
firstName
lastName
profileImage
}
}
}


and my files are located in the following order,



Project




  • ->appDelegate

  • ->info.plist

  • ->schema.json

  • -->Graphql[Folder]


  • ->API.swift


  • ->ApiFile.graphql



My API.swift file still exist only with header




import Apollo




. Anyone can you please help me to findout the solution







ios swift graphql apollo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 8:26

























asked Nov 12 at 4:32









Angel F Syrus

26112




26112








  • 1




    1. Update your schema.json before build. 2. Build normally in XCode (if you attach shell script for running GraphQL parser). It should update the file API.swift. According to your GraphQL file, you should be able to call the class with name SigninQueryMutation(email: , password:)
    – Cosmos Man
    Nov 12 at 7:29












  • @CosmosMan Thank you for your reply but can you please explain me how to update schema.json file...
    – Angel F Syrus
    Nov 12 at 8:28






  • 1




    What I actually mean by update is to regenerate the schema.json. I think some script is missing in your XCode build phase. How graphql works is, 1. You inspect graphql schema and generate it as schema.json or some_other_name.json. 2. Then feed that schema.json or some_other_name.json to your graphql parser to parse your .graphql files. If something missed between schema.json and .graphql files, it won't work. Something like isUserPretty is missing from user. If nothing happened, it should be working fine.
    – Cosmos Man
    Nov 12 at 8:29










  • For example, a script for generating schema.json look like this. apollo-codegen introspect-schema http://www.your-server:8080/graphql --header "Authorization: Bearer some kind of authorization code" --output schema.json.
    – Cosmos Man
    Nov 12 at 8:32






  • 1




    a script for generating API.swift looks like this. APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)" if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project." exit 1 fi cd "${SRCROOT}/${TARGET_NAME}" $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
    – Cosmos Man
    Nov 12 at 8:33
















  • 1




    1. Update your schema.json before build. 2. Build normally in XCode (if you attach shell script for running GraphQL parser). It should update the file API.swift. According to your GraphQL file, you should be able to call the class with name SigninQueryMutation(email: , password:)
    – Cosmos Man
    Nov 12 at 7:29












  • @CosmosMan Thank you for your reply but can you please explain me how to update schema.json file...
    – Angel F Syrus
    Nov 12 at 8:28






  • 1




    What I actually mean by update is to regenerate the schema.json. I think some script is missing in your XCode build phase. How graphql works is, 1. You inspect graphql schema and generate it as schema.json or some_other_name.json. 2. Then feed that schema.json or some_other_name.json to your graphql parser to parse your .graphql files. If something missed between schema.json and .graphql files, it won't work. Something like isUserPretty is missing from user. If nothing happened, it should be working fine.
    – Cosmos Man
    Nov 12 at 8:29










  • For example, a script for generating schema.json look like this. apollo-codegen introspect-schema http://www.your-server:8080/graphql --header "Authorization: Bearer some kind of authorization code" --output schema.json.
    – Cosmos Man
    Nov 12 at 8:32






  • 1




    a script for generating API.swift looks like this. APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)" if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project." exit 1 fi cd "${SRCROOT}/${TARGET_NAME}" $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
    – Cosmos Man
    Nov 12 at 8:33










1




1




1. Update your schema.json before build. 2. Build normally in XCode (if you attach shell script for running GraphQL parser). It should update the file API.swift. According to your GraphQL file, you should be able to call the class with name SigninQueryMutation(email: , password:)
– Cosmos Man
Nov 12 at 7:29






1. Update your schema.json before build. 2. Build normally in XCode (if you attach shell script for running GraphQL parser). It should update the file API.swift. According to your GraphQL file, you should be able to call the class with name SigninQueryMutation(email: , password:)
– Cosmos Man
Nov 12 at 7:29














@CosmosMan Thank you for your reply but can you please explain me how to update schema.json file...
– Angel F Syrus
Nov 12 at 8:28




@CosmosMan Thank you for your reply but can you please explain me how to update schema.json file...
– Angel F Syrus
Nov 12 at 8:28




1




1




What I actually mean by update is to regenerate the schema.json. I think some script is missing in your XCode build phase. How graphql works is, 1. You inspect graphql schema and generate it as schema.json or some_other_name.json. 2. Then feed that schema.json or some_other_name.json to your graphql parser to parse your .graphql files. If something missed between schema.json and .graphql files, it won't work. Something like isUserPretty is missing from user. If nothing happened, it should be working fine.
– Cosmos Man
Nov 12 at 8:29




What I actually mean by update is to regenerate the schema.json. I think some script is missing in your XCode build phase. How graphql works is, 1. You inspect graphql schema and generate it as schema.json or some_other_name.json. 2. Then feed that schema.json or some_other_name.json to your graphql parser to parse your .graphql files. If something missed between schema.json and .graphql files, it won't work. Something like isUserPretty is missing from user. If nothing happened, it should be working fine.
– Cosmos Man
Nov 12 at 8:29












For example, a script for generating schema.json look like this. apollo-codegen introspect-schema http://www.your-server:8080/graphql --header "Authorization: Bearer some kind of authorization code" --output schema.json.
– Cosmos Man
Nov 12 at 8:32




For example, a script for generating schema.json look like this. apollo-codegen introspect-schema http://www.your-server:8080/graphql --header "Authorization: Bearer some kind of authorization code" --output schema.json.
– Cosmos Man
Nov 12 at 8:32




1




1




a script for generating API.swift looks like this. APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)" if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project." exit 1 fi cd "${SRCROOT}/${TARGET_NAME}" $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
– Cosmos Man
Nov 12 at 8:33






a script for generating API.swift looks like this. APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)" if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project." exit 1 fi cd "${SRCROOT}/${TARGET_NAME}" $APOLLO_FRAMEWORK_PATH/check-and-run-apollo-codegen.sh generate $(find . -name '*.graphql') --schema schema.json --output API.swift
– Cosmos Man
Nov 12 at 8:33



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255997%2fapi-swift-file-not-update-apollo-graphql-ios%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255997%2fapi-swift-file-not-update-apollo-graphql-ios%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python