How MEGA engineered its iOS design tokens module

Introduction

Here at MEGA, in order to build a consistent UI experience throughout all of our products on different platforms (Android, desktop, iOS, and our websites) it became clear that we needed to create a robust, consistent, and sustainable design system for our codebase.

With that goal in mind, we’ve decided to adopt an approach where design tokens (the basic building block of any design system: colours, radius, spacing, etc.) are defined in JSON specs given by the design team, in a way they can be used in a platform-agnostic manner.

In this article, we’ll deep dive into how we built MEGADesignToken - the Swift Package Manager (SPM) module responsible for creating and exposing Swift code based on those files, tackling topics such as: SPM Build Tool plugins, parsing strategies, data modeling, algorithms and code generation through SwiftSyntax.

Learn More

Tags: module Tokens