Questions tagged [apollo-ios]

A strongly-typed, caching GraphQL client for iOS, written in Swift.

32 questions
1
vote
1 answer

apollo-ios updating cache not working as unless re-rendering view

apollo setup import Foundation import Apollo class Network { static let shared = Network() private(set) lazy var apollo = ApolloClient(url: URL(string: "http://localhost:4000/graphql")!) } querying data and storing in state @State var…
abesan
  • 11
  • 3
1
vote
1 answer

Swift: Cannot convert Type to Type

I am looking to create a function to handle potential errors in GraphQL mutation results, using the Apollo SDK. Apollo can have errors as part of its success data. To keep it as generic as possible, I define my function as: func…
Tom Petit
  • 33
  • 5
1
vote
2 answers

Is it possible to force encode Date as Date type instead of string?

I am trying to mock Apollo Queries using its init. It pretty much is taking in a dictionary to build the object up. public init(unsafeResultMap: [String: Any]) { self.resultMap = unsafeResultMap } So, I have decided to create Mock objects that…
Mocha
  • 2,035
  • 12
  • 29
1
vote
1 answer

Apollo GraphQL header always gives failure in iOS Swift

I am working with the Apollo GraphQL client for the first time in my swift project. Followed all the steps mentioned in their document and searched over google for my issue but had no luck. I have made a query request by passing a header in my…
Princess
  • 309
  • 3
  • 17
1
vote
1 answer

Apollo graphQL: Error decoding Array while using custom scalars in iOS swift

I have schema as show below. Here question_r is an array of dictionaries received as Json. I am facing issue converting it. Is there any way i can successfully decode it? "questionR": [ { …
truLearner
  • 71
  • 10
1
vote
2 answers

How to get value out of Apollo iOS Closure? / How to "wrap" a closure in a function?

I'm using Apollo iOS to fetch GraphQL queries. I want to move the apollo.fetch() query closures to a separate function in a class. This class will contain a static reference to the apollo client as well as functions for performing GraphQL mutations…
ryanmattscott
  • 321
  • 5
  • 17
1
vote
1 answer

Apollo iOS codegen: Nested use of a fragment in a mutation creates unexpected property types in Fragments struct

I have the following fragment: fragment User on UserResponse { firstName lastName emailAddress emailConsent phoneNumber } When used as root in a mutation, the code generation will correctly generate a root User struct in…
buron
  • 181
  • 7
0
votes
0 answers

How to integrate iOS Apollo SDK 1.x Version using cocoapods?

I'm trying to integrate Apollo SDK version 1.x using cocoapods. I have added pod "Apollo" in podfile and successfully downloaded Apollo (1.0.7) version. My question is how to add(path/directory) schema.graphqls and queries, how to generate query…
0
votes
1 answer

Apollo iOS how to handle partial decoding failure

I'm trying to see if there is a way to do more robust handling of partial decoding failures of Apollo generated Swift classes. Currently, if even one field of one object in an array fails to parse from the network response, the entire collection of…
Liam
  • 108
  • 5
0
votes
0 answers

Apollo graphql IOS Apollo.JSONDecodingError.couldNotConvert not accept geojson type

Hello our swift project service layer changing to graphql. I have a problem with one service i couldn't fix it. when i request that service with postman i get this response. "geometry": { "type": "Polygon", …
ALKIN ÇAKIRALAR
  • 237
  • 2
  • 14
0
votes
1 answer

Specify cache policy for parts of a graphQL query

In Apollo's GraphQL version, there are fetch policies that specify whether a fetch query should obtain data from server or use the local cache (if any data is available). In addition, cache normalization allows usage of the cache to cut down on the…
Winston Du
  • 340
  • 2
  • 9
0
votes
1 answer

SwiftLint config in dependency source conflicts with SwiftLint in main project

I have a project that uses SwiftLint and Swift Package Manager. One of the packages I'm pulling in (Apollo) is in turn pulling in another framework (Stencil). That framework (Stencil) has a swiftlint.yml file in its source with a specific…
SeanR
  • 7,899
  • 6
  • 27
  • 38
0
votes
1 answer

GraphQL Resolvers on client side for Apollo-iOS

How do I write a resolver for making multiple API calls to fulfil a GraphQL query using Apollo-iOS on the client side (in my swift project)? For Example: If, to construct a Person object from a query having name and age parameters - I have to fetch…
0
votes
1 answer

How do I use Hasura/postgres uuid with apollo-ios and swift

I have a table defined in Hasura (Postgres) using native uuid as the field datatype. My goal is to create an update mutation from Swift but the uuid type is not mapped implicitly from Postgres through Hasura and Apollo to Swift. The Hasura…
levous
  • 902
  • 7
  • 13
0
votes
1 answer

How to read results using Apollo Client for iOS

I'm trying to use GraphQL in iOS with Apollo Client. I have the following mutation: login(user: String!, password: String!): UserType and the UserType looks like this: id: ID user: String! password: String! name: String lastname: String email:…