Hello Everybody,
This article is very helpful for you.
PART-1
If you completed these five points, then you can continue itβ¦
I want to complete these 5 points.
in this example we use this end point to fetch query.
GraphQL Endpoint β https://countries.trevorblades.com
First you should check your query is working or not in your GraphQL Playgroud.
If your query is working good then copy your query and paste in your Query.graphql file in your projecrt.
NOTE: β If in your side this query is not comming colorfull then please don't worry π. I βll explain later ok, no worries π.
Ok after pasting Query in query.graphql file press Command + B or Build your project.
your XCode will Generate API for getCountry Query.
Well done, here your part 1 is completed, Take rest if you want take Tea or coffee. and come back again.
Part -2
Now you should create a file that name is YOUR_PROJECT_NAMEAPI.swift
You can set deferent name of that file according to your project.
For Example.
And in this LearningGraphQLAPI.swift file import three things files and also create a class in this file and class name is LearningGraphQLAPI.
And then in the class create a new method called getCountryDeatils().ππΌ
And in video ππΌ I forgot to create static shared object of LearningGraphQLAPI in this class see line no. 15 ππΌ.
I hope in your side there are no errors.
Now Open Your view controller file and write this code. ππΌ watch video.
OUTPUT β
NOTE β I hope everything is working fine for you. and if you getting some or any kind of error then please comment ππΌ.
or you can PING me β trot.stalls.0l@icloud.com