Tagged with apollo

Browse all tags

Clearing up after subscribing to Swift WebSockets

Feb 25, 2020

Opening and keeping a WebSocket connection alive isn't enough when dealing with it. The connection needs to be closed either from user or sever side. That is [mentioned](https://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#section-6) in the official WebSocket protocol. Previously we have seen how to implement WebSockets using [Starscream library](/websockets-swift/), [URLSessionWebSocketTask](/websockets-ios-13-swift/) and [GraphQL](https://kristaps.me/graphql-subscriptions/) in Swift projects. This time we will look into cleaning up the connection after you don’t need it anymore.

Read more

Ignorance of the URLRequest cache

Jan 18, 2020

Caching and invalidating cache is one of the hardest things in computer science [according to](https://martinfowler.com/bliki/TwoHardThings.html) Martin Fowler. Recently I was dealing with cache and invalidating it in three of my applications. I had some serious issues with that and wanted to dig deeper. This time we will discuss `URLRequest` caching strategies and how to use it in your apps. I will share some of my learnings and problems that I found.

Read more

GraphQL Advances when fetching data in iOS with Swift and Apollo SDK

Dec 27, 2019

In previous articles, we discussed how to [get started](/graphql-ios-swift/) with and use [subscriptions](/graphql-subscriptions/) with GraphQL in iOS (and iPadOS, tvOS, and macOS) using Swift programming language. This time I want to discuss some advanced topics using GraphQL with Apollo SDK and Swift: usage of GraphQL fragments and Swift scalar types; optionality with GraphQL and it’s pros and cons.

Read more

How to use subscriptions with GraphQL using Apollo iOS SDK and Swift

Nov 26, 2019

GraphQL main functionality is to fetch and update data from the server. In addition to that subscriptions allow us to listen and to send messages from and to server in real-time. It is similar to regular queries, but the answer will be received when an event happens either on the server or on the client. Apollo iOS SDK library supports subscriptions and it is powered by the Swift WebSocket library [Starscream](/websockets-swift/) behind the scenes to connect to the server. Let's look at how to set it up and start using it.

Read more