Real time development in iOS with Injection (Part 1)

I will show you how to develop app without rebuilding.

We often need to look at small changes like move view by some pixels, change color, change layer property like cornerRadius and many others. For all of this changes we need to rebuild the app, that can takes long time. Injection app solve this problem.

I will use Xcode 8 and Swift 3 but it can be done for any Apple language.


First of all you will need to download standalone Injection app from the site or use direct link.

Launch it.

Why does injection require my administrator password? Check this FAQ for full description.

Turn on File Watcher in menu of Injection:


Choose one of your projects or create a new one.
You will need this function:

func injected() {
print("I've been injected: \(self)")

Enter it in UIViewController that you want to change. For new project it will be ViewController. You will have something like this:

Run project.

Important: use simulator with 64bit architecture like iPhone 5s or higher. In the next part I will show how to use others like iPhone 4s and don’t get error like:

Now use shortcut CTRL+= or menu of Injection app to inject source:

In the Xcode console you will have something like this:

2017-04-11 22:12:26.163 testInject[47084:1708904] Injection attempting connection to:
2017-04-11 22:12:26.164 testInject[47084:1708904] Connected to "Injection" plugin, ready to load x86_64 code.
Extracting project parameters into /Users/zdaecqzezdaecq/Library/Developer/Xcode/DerivedData/testInject-crjaobaetsgerqefsjlvlpnprvlo/Logs/Build/../iOSInjectionProject/x86_64/identity.txt ...
** File not recently modified. Did you save it? **
Compiling /Volumes/Second/XcodeProjects/testInject/testInject/ViewController.swift
... First time learning of project, one second ...
objc[47084]: Class _TtC10testInject14ViewController is implemented in both /Users/zdaecqzezdaecq/Library/Developer/CoreSimulator/Devices/302B8EAE-68C3-4BED-829E-BB598306DC4A/data/Containers/Bundle/Application/88F773BE-26D4-4191-8838-9D73ED097E6F/ (0x102ea5180) and /Users/zdaecqzezdaecq/Library/Developer/Xcode/DerivedData/testInject-crjaobaetsgerqefsjlvlpnprvlo/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle27.bundle/InjectionBundle (0x111b3f300). One of the two will be used. Which one is undefined.
1 injections performed so far.
2017-04-11 22:12:29.182 testInject[47084:1708728] Ignore any warning, Swizzled testInject.ViewController 0x111b3f300 -> 0x102ea5180
I've been injected: <testInject.ViewController: 0x7fc36e408ae0>

Last strings will contain:

Ignore any warning, Swizzled...
I’ve been injected:...

It means that injection have been setup successfully.

Now do any code in veiwDidLoad. I will change background color:

override func viewDidLoad() {
view.backgroundColor =

Now save file with menu or with shortcut CMD+S and simulator should change background color automatically without rebuild:

Great! Now you can do any changes you what.

Don’t forget Inject Source after start the app.

Real devices is no longer possible due to iOS 10’s sandboxing.

In the next part:

  • we will setup automatic Inject Source
  • will use simulator without 64bit architecture like iPhone 4s
  • some my features for lighter injections
  • and project from gif example

Part 2 is ready: