Kristaps Grinbergs iOS, tvOS, watchOS, macOS in Swift

Ignorance of the URLRequest cache

18 Jan 2020

Caching and invalidating cache is one of the hardest things in computer science according to 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.

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

27 Dec 2019

In previous articles, we discussed how to get started with and use 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.

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

26 Nov 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 behind the scenes to connect to the server. Let’s look at how to set it up and start using it.

What is PassKit and how to use it?

20 Oct 2019

Apple PassKit framework is responsible for Apple Pay and managing user passes in Wallet app.

This time let’s talk about passes, how to create and distribute them. Wallet app allows iOS users to organize boarding passes, tickets or gifts, business and loyalty cards. In short, passes are digital representations of information that usually is printed on paper or used as plastic cards.

Dark Side of the App Store

25 Sep 2019

I am an Apple fanboy and I admit that. But one of the most frustrating things in being an app developer is dealing with the App Store review and compliance teams. This time I would like to share my experience with these problems.

Even Apple’s former app approval chief has said that he is ‘really worried’ about company’s anticompetitive behavior.

Using GraphQL in iOS with Swift

28 Aug 2019

GraphQL is an alternative to the commonly used REST API approach. When using GraphQL you only get one single endpoint to the server and through that endpoint you need to specify the exact data you need. It was created by Facebook in 2012 and open-sourced in 2015.

Using GraphQL in your Swift applications is not that hard. The easiest way is to use Apollo iOS client which recently has seen a lot of great improvements and bug fixes. Apollo iOS is a strongly-typed, caching GraphQL client for iOS, macOS, iPadOS, watchOS, and tvOS. It is written in Swift programming language.

Websockets in iOS 13 using Swift and Xcode 11

24 Jul 2019

Websockets in iOS 13, macOS 10.15, tvOS 13, watchOS 6 and Mac Catalyst have gained first-class citizen status in networking stack. Apple has finally added support in URLSession and for lower level in Network.framework for their platforms.

This time we will focus on implementing Websockets using URLSession capabilities.

WWDC 2019

26 Jun 2019

This year I finally had a chance to attend WWDC (Apple Worldwide Developers Conference). It has always been my dream to go there and see the Keynote, conference and all other events with my own eyes.

UIView vs CALayer

03 May 2019

Here’s something useful to know - UIView’s are backed by CALayer’s. Layers offer a lower-level interface to the visual content. When we need more flexibility or performance, we can go to layer level.

What is (Core) Animation

27 Mar 2019

Animation has been an important part of the Mac OS X user interface since the very beginning. You’ve probably seen the Genie effect, which occurs when you minimize an application, so many times that you hardly notice it anymore.

Apple integrates animation into its operating systems and applications, and it is becoming so commonplace that users are starting to expect it.

Core Animation is a group of features that makes it easy to build animated user interfaces for the Apple ecosystem devices like iPhone, iPad, Apple TV, and Mac.

Animating shapes in iOS

12 Feb 2019

Animating a UIBezierPath drawing is a pretty trivial task. But how to animate shape morphing, i.e. make one shape change into another? (For instance, morphing a triangle into a square.) To accomplish this, we need to use CAShapeLayer and animate its properties using Core Animation capabilities.

Websockets in iOS using Swift

05 Jan 2019

WebSockets allow for extremely fast two-way networking communication, which lets you send and receive updates quicker and more often, not to mention securely. WebSocket is a communication protocol that uses sockets, providing duplex communication over a single TCP connection. It was standardized by the IETF in 2011 and is a different protocol from HTTP.

WebSockets are widely used in chat apps, streaming real-time notifications, and stock prices.