George Green of London

Read this first

Peek and Pop


So if you’re anything like me, a few weeks ago (at time of writing) when the new iPhone 6s came out, you spent most of the day anxiously waiting for the arrival of your new phone, which you had pre-ordered the moment it was available for pre-order? One of the major new features that we now have is touch-sensitivity on the screen! And with this a new standard “Peek and Pop” gesture was introduced allowing users to press into content to see a preview, and then press harder to pop into the full detail screen. Of course, the first thing we want to do is introduce this awesome new feature to all of our apps.

Introducing Peek and Pop

As it happens, if all we want is the standard “Peek and Pop” behaviour, similar to how Apple have it in Mail and Messages, it’s super easy to add. Especially if we already have a push-pop navigation stack such as the one we get when using a UINavigationC...

Continue reading →

Mastering GCD - The Basics


The next few posts are aimed at really getting to grips with Apple’s GCD (Grand Central Dispatch), understanding what it does, how to use it, and most importantly when and why we might need to use it. If you’ve read the previous post, or perhaps you’ve used multi-threading on another platform, you’ll be familiar with the idea of an application being able to manage multiple threads in order to asynchronously perform multiple tasks. With GCD we never actually get to see a thread, Apple have provided a quite nifty abstraction in the form of dispatch queues. I’ll explain what those are in just a moment. Jargon first, lets demystify some of the jargon!


  • Synchronous - The majority of calls you make in your apps are synchronous. This means that when you call a function, it completes everything it wants to do before returning.
  • Asynchronous - In this case, you make a call to a...

Continue reading →

Concurrency in iOS


So… where to begin? There are many situations in which an application is required to do multiple things concurrently in order to improve the user experience, especially on iOS where the main thread controls the UI. This of course means that if we do anything too intensive on the main thread, the UI gets blocked and gets a bit jumpy… not good!

What is concurrency?

At a very basic level, a processor can essentially do one thing. It can perform one command, followed by another, and another and so on, this is its life. Of course, with modern devices it’s a bit more complicated, but the basic principle still holds.

This system works fine when you have one piece of software running, but when there are multiple, say the OS and several other apps, all running at the same time, we need some way of sharing the processor time between the different processes. The OS basically loops...

Continue reading →

Object-based Event Tracking


Ok, so, I’m sure we’ve all had a go of many different analytics tools over the years but for me there is one thing that is lacking. Event tracking at the object level. Please do get in touch if you are familiar with an off-the-shelf solution that works in a similar way, but I have yet to find one that works how I would like it to.

This article will use pseudo-code to indicate various points, though you may notice that it is somewhat swift-esque.

The old way

So the way most analytics tools work (I’ve used Mixpanel, AppsFlyer, Facebook Events, Crashylitics, Flurry and Google Analytics) tends to be that you have users and you have events.

Users: An instance of the app will typically identify as a user and then is able to story key-value style properties against the user. No history is stored on these, you can just see what the current value of a property is. This is typically...

Continue reading →

Mastering C++ Sockets (Server)


In this series of posts we’ll look at how we can setup a socket connection between two C++ applications. We’ll look individually at the two halves, the “server” end which will bind and then wait for connections, and the “client” end which will attempt to connect to the server. We’ll then go on to look at how we can push data across the socket in both directions, how to select on a set of socket file descriptors and how to use threads to setup a reliable and efficient system for handling persistent sockets.

Note: While I’ll endeavour to explain things as best I can, bear in mind that sockets are not a basic topic and if you do not already have a solid grasp of C++ and what sockets are, this post may not be for you.

Server side

There are 4 steps that we need to take to setup the server-side of the socket connection. We need to create a socket, bind the socket to a port, put the...

Continue reading →

Mastering C++ Sockets (Client)


Incase you missed it, in the previous post we covered how to setup a very basic server-side socket. This post will continue the series and cover how to setup a client application that can connect to the server that we created in the last post. If you missed it now would be a good time to head back and check it out.

Client side

The client side is a little simpler than the server, all we need to do is create the socket and instead of binding to a port, we need to connect to the server.

Before we get started, you’ll need to include the following in your C++ file for the rest of this tutorial to work:

include <netinet/in.h>
include <unistd.h>
include <sys/types.h>
include <arpa/inet.h>

Creating a socket

To initially create the socket and get a valid file descriptor (an id by which we will reference the socket in the future) we call the socket() function. To get started we want...

Continue reading →