I was recently invited by Voodoo to meet Sarra Srairi, an iOS SDK Engineer inside the Growth & Engineering Team. As an independent iOS developer, I was really excited to have a better understanding of how they managed to publish more than a hundred games and reach the huge number of 4 billions downloads on the different app stores. Their games are played by more than 300 millions users each month in almost every country of the world. I believe that it is an incredible opportunity for a developer to work on this kind of project which impacts millions of people.
Among the different topics that we discussed I was particularly interested in the way they build and distribute their iOS SDK across their games. 

What is Unity and why do we need native iOS developers ?

For those who are not familiar with the gaming industry, it is important to remember that the majority of games are built using a game engine. A game engine speeds up the development process of a game by providing key features such as the rendering engine or the physics engine.
Unity is probably the most popular engine to this day. In 2019, they claimed to power more than 50% of games (PC/console/top mobile games combined). With that in mind, it’s no surprise that most Voodoo games are made with Unity.

A game engine such as Unity includes features to build the video game on different platforms (for instance Android and iOS) and a documentation to publish it directly to the store in a few minutes but the reality is not that simple…
Indeed, a key player such as Voodoo who runs more than 100 games needs to add some features to each game before pushing it to the stores. Some of these features require to use native functions or SDK. This is where Sarra comes in to build the iOS SDK that will be used for all iOS games. 

Sarra told me about two use cases : 

  • Implement a native feature : the native iOS Multiple Subscription (multi-app subscription) package is more flexible than the Unity version
  • Use features from third party SDK that are not (fully) accessible from Unity like Facebook or Tiktok SDKs 

Build the bridge between iOS and Unity

Before having a deeper look at these use cases, I was very surprised to learn from Sarra that it was possible to run Native iOS code on a Unity project. Indeed, a Unity project is mainly written in C# and you will have to use an IDE that supports .NET to develop your video game like Visual Studio or JetBrains Rider.

When you choose to build your unity project for the iOS platform, Unity creates a folder that contains a Xcode project. This project will automatically include all the files that are necessary for Xcode to build and publish your project (classes, assets, .NET assemblies…). I recommend to have a look at the Unity documentation if you are curious about this Xcode project structure here.

Sarra explained that they need to create a bridge between the iOS world (in Objective-C and Swift) and the Unity world in C#. They call this layer of communication a “wrapper”. 

The wrapper will work in both directions : the Unity app must be able to send and request information from native functions.

I will not describe all the technical stuff behind this bridge but it is really cool if you like to have a deep understanding of Unity and iOS work. Sarra wrote a very interesting article about it last july and I also found this article from a developer at Line that helped me understand the full process. 

ios sdk unity

Leveraging Cocoapods between Xcode and Unity

Sarra uses Cocoapods to manage iOS framework dependencies for the Unity Build. If you have never heard of Cocoapods, it’s a tool to simplify installation and sharing of Swift/Objective-C frameworks. The tool is built in Ruby and was created in 2011. Cocoapods is widely used by iOS developers, it’s stable and efficient. 

Behind the scene, Cocoapods will search for the framework installation instruction inside the official repository available on github here. (It’s pretty impressive to have a look at the number of commits on this repo, each of them is a library that is added or updated, 562k when I’m writing these lines). You can also use private repositories on Github (that will be the case for Voodoo projects mostly for security reasons.)

Install framework with cocoapods

The next step for Sarra is to publish Voodoo iOS frameworks using Cocoapods. This process is pretty straightforward. You need to create a repository on github and create a .podspec file that includes all the installation instructions. 

1. Create the podspec inside your iOS framework

2. Push your source code on git with the same link and tag version as your podspec definition (cf the line 8 in the podspec just above)

3. Consume your framework using a pod file. If you use your own github Spec repository don’t forget to link your pod file to this github specs sources The Podfile should look like this once you build your unity project exemple :

4. You can use the External Dependency Manager If you want to consume your framework inside unity. Like this :

Voodoo is actively looking for talented developers to join them !

This example with Cocoapods and Unity is just a tiny example of clever solutions that you have to find when you build mobile applications at scale. You always have to think about new solutions !
Voodoo values ownership : Each member of the team is the owner of the objective of this team is trying to reach. Sarra contributes using her expertise and passion on iOS but Voodoo mission is to entertain 300M people every month and they are looking for all kind of talents :

  • Mobile SDK engineers (Unity, Android, iOS…)
  • Front-end web developers (VueJs, React, Angular…)
  • Back-end developers (Node, Spark, Scala…)
  • Data engineers (spark, Python, Airflow…)

I strongly recommend to have a look at their WeLoveDevs company page and their career website to learn more about these jobs !

Vincent Cotro

Auteur Vincent Cotro

Plus d'articles de Vincent Cotro

Laisser un commentaire