Kodular Companion for iOS

An iOS Companion isn’t possible to make, I’m afraid.

Here’s what happens to your blocks when the Companion is connected:

  1. Your mobile device becomes a web server (identified by its IP address*) which the Creator tries to connect to.
  2. Once the Creator has connected to the Companion, it initiates a REPL (read/eval/print/loop).
  3. Your blocks are converted into YAIL (Young Android Intermediate Language), which is a series of macros written in Kawa Scheme, and sent to your device line by line.
  4. The Companion then does 4 things as per the read/eval/print loop
  • a. It reads the YAIL data sent to it by the Creator.
  • b. The YAIL macros are converted in Java Virtual Machine bytecodes, which are then converted into Dalvik Virtual Machine bytecodes
  • c. Android runs these DVM bytecodes natively, thereby “mirroring” your app in real-time
  • d. If the web server is still open, return to step a.

iOS does not support steps b and c, which is why we cannot run the Companion on Apple devices.

*To be able to connect to the Companion, the Creator needs to know which web server it has to connect to. The web server is identified by your device’s IP address, which the Creator must know before opening a connection. To do this, your IP is sent to a common database (called the rendezvous server) which both your device and the Creator can access.
You are then asked to enter a 6 digit code which appears on the Creator, with the help of which the Creator can correctly identify which IP address it must connect to.

I hope this sheds some light on the workings of the Companion :smiley:

References:

13 Likes