You probably send or receive data over the network in your apps. You probably use Encodable and Decodable protocols to do that job. You have probably already been confronted with parsing errors because your backend is not available to ensure the validity of the data. How to deal with that ?

Photo by Ivan Vranić on Unsplash

Here is an example of a payload from a webservice that returns a list of train tickets (extracted from a swagger). Because the backend calls another backend that calls another backend, that calls…etc, the data is not safe and all properties are optional except pnr.


Photo by Messala Ciulla on Unsplash


SwiftUI seems to be great but unfortunately developers will be able to use it only if they target their app on ios13.
But SwiftUI is built on top of some new swift 5.1 features that can be used with previous iOS versions.
It’s the case of @functionBuilder(Swift Evolution Proposal).

Some people have already explained the power of @functionBuilder, I invite you to read them if you need more information:

The more I like with SwiftUI is the readability of the UI implementation. And It’s possible thanks to @functionBuilder.
I have been working for a few years on a library called…

In this article, we will create an external framework that will expose some cells, a background and horizontal line decorationViews and one vertical custom UICollectionViewFlowLayout that manages margins and paddings between cells.

The app and it’s debug view

Why using UICollectionview ?

According to your app, using UICollectionView to build your screens could save you a lot of time, mostly if your screens are data-oriented and contextual.
It’s easier to add a cell between two others than updating constraints to show or hide an UI element.

A powerful feature of UICollectionView is DecorationView. …

Have you ever played Chromino ? I did with my family and while I was playing, I got the idea to create Troisix. Three years later, I’m proud to release it and I hope you will have as much fun playing it as I had developing it.


What’s Troisix

Official Description

Troisix is a puzzle game for iPhone and iPad that might look simple at first but will quickly make your head spin. Inspired by domino and chromino board games, Troisix is ​​reinventing the whole concept and bringing complexity and fun to the next level.

The colors like to play peacefully together, stick…

Photo by Jessica Ruscello on Unsplash

When you are using CollectionViews or TableViews, the difficult part is when you need to add, remove, move some cells or update their content.

Even more when you are using decoration views.


Look at these 2 arrays:

let old= ["A","B"]
let new= ["B","C"]

The differences between these arrays is very straight forward to compute:

deleted :  [0] // index in the old array
moved : [(from:1, to:0)]
inserted : [1] // index in the new array
reloaded : []

To compute this diff, we use a key to compare the two arrays, which is the value in the array in…

The problem

At, the main app for booking train tickets in France and Europe, our main job is to display what the server sends to us, most of views are also dynamic. Furthermore, the app is often updated with new features, even static views evolve constantly.

So, we decided to use UICollectionView! It’s powerful, dynamic and customisable.

But the Apple’s indexPath oriented implementation could become messy when there is a lot of different items, like in the app:
Code duplication, switch case, difficult to maintain, risks of indexPath errors during updates, …


We have built a framework for one year…

Gwenn Guihal

Lead iOS developer at, Paris / Indie game developer (cocos2d-X). Creator of YesSir and Troisix.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store