How it Works

Paul Taykalo edited this page Jun 2, 2015 · 4 revisions

There's three main parts in DYCI

  • Clang-proxy compiler
  • Plugin-based compiler
  • Dynamic library compiler
  • iOS Dyci Library

Step 1. Search how file was compiled

Clang-proxy compiler

At installation phase, your clang compiler will be switched to the "fake" one. Main purpose of this clang-proxy compiler is to save parameters for each file that was compiled. After save, it calls real clang.

(Note: This part is about to change, because we don't think that proxying clang is the best idea. In next version we are going to perform this task without clang-proxy)

** OR **

Plugin based compiler (Xcode only since 1.6.0)

At installation phase your clang compiler will remain untouched. (use ./install.sh -s)
In order to search compilation parameters for each file, Plugin is using Xcode runtime.

Step 2. Wrap result the result

Dynamic Library Compiler

When you are executing "Recompile and Inject" from Xcode, dyci working in this way:

  1. Recompiles your selected file class X, with parameters that was saved earlier by clang-proxy.
  2. After successful compilation, object file that was received after compilation, is wrapped to dynamic library (dylib)
  3. This dylib file is placed to user home directory (~/.dyci)

Step 3. Deliver updated code to the Simulator and inject it

###iOS Dyci Library

  1. On iOS Simulator side, iOS dyci Library are watching for changes in (~/.dyci)
  2. When new file appeared, it loads new dylib with dlopen function
  3. If all went OK, then at current moment we have 2 (or more) instances of class X.
  4. dicy Library changing all methods of your current class with the new implementations Additionaly, if instances of class X has declared -(void)updateOnClassInjection method, then this method called for each instance

When all three parts succeded, you save some amount of time.