How to set cookies to the Apollo Client for Swift project

How to set cookies to the Apollo Client instance in swift project,

I’m trying to set using below code but no luck.

let jar = HTTPCookieStorage.shared
let cookieHeaderField = [“Set-Cookie”: “key=value”] // Or [“Set-Cookie”: “key=value, key2=value2”] for multiple cookies
let cookies = HTTPCookie.cookies(withResponseHeaderFields: cookieHeaderField, for: url)
jar.setCookies(cookies, for: url, mainDocumentURL: url)

Can you please help on this?

Hi! Where are you setting this up?

For what it’s worth a good place to start would be to take a look at our document on advanced network client setup, which walks through setting up an ApolloInterceptor to add custom headers.