Probably you saw many JSON parsing examples, but this one is really easy. And available out of the box with Swift 4.
All you have to do is create models from Codable superclass, and use:

Check out provided playground here!

Output in console should be:

As you probably notices, simple screen drawing is useless if it comes to OpenGL view. So is it possible to generate UIImage from such? Of course, lets suppose your custom drawing class extends UIView, then just add:

This code works in XCode 9 and Swift 3.x.

Sooner or later, you will face the problem with object which are not deallocating. How to check if object gets deallocated? Just use deinit method like below:

If you won’t see such message when you think you class should be gone, the easiest way is to debug allocations. Because the most common reason for such behavior are strong references, you can print allocation counter this way:

But where to put this? First of all, in all you initialization methods. Just add some those prints after each few lines, and you should see where counter is growing. The same in cleanup methods, or if you dont have any, you can put this somewhere when your view controller is closing, like:

And how to avoid strong references? The most common mistake, is using self in blocks, this is the place where you should use [unowned self], this way: