Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Using dyci

vixentael edited this page Feb 19, 2013 · 23 revisions

At first, please, look to example, that goes with the main project. Really:)

#1 Adding sources

There's plenty ways to add dyci to your project, but these two are the most preferable

###As CocoaPod Just add this line in your PodFile
pod 'dyci', :git => 'https://github.com/DyCI/dyci-main.git'
FYI, CocoaPods are great! :)

###As subproject Just grab dyci project to your workspace Add it as dependecy in your project Adding as static library

###As static framework This is the best way for those, who have non-ARC projects, or have projects structure without workspace.

  1. Download dyci.framework from Downloads page
  2. Add Framework to your project
  3. Make sure that you have -ObjC flag in Other Linker Flags setting

#2 Enabling Dyci

All you need to enable dyci is to correctly oeform previous task.
That's all. Dyci is enabled on your project now, so you can use it.
If all went ok, then you'l see log, that will have announce about dyci enabled state.

###First-time recompilation. At the same first time you need clean your project and recompile. In other case, you won't be able to use dyci, since, it wont be able to compile your file correctly

#3 Using!

###Recompile and Inject If you successfully installed dyci, you have additional menu item in "Product" menu in Xcode, with "Recompile and Inject ^X" name.
Note that, you need your application to be running, to use this tool :)
Each time, you pressing '^X', your class is being injected to your running application.
If you have errors in your code, then Xcode will fail and show alert with notification that code cannot be compiled.
If all went good, you see alot of information about injection in Console. Read it carefully. At least first time.

================================================= 
Found new DCI ... Loading
objc[4334]: Class DYCIViewController is implemented in both ... One of the two will be used. Which one is undefined.
DCI was successfully loaded
Searching classes to inject
Injecting  class : DYCIViewController
Injecting meta class : DYCIViewController
Class (DYCIViewController) and their subclasses instances would be notified with
 - (void)updateOnClassInjection 
Class was successfully injected
  

If you don't see these lines, then something went wrong. Recheck your previous steps.

For AppCode users

Now hotkey for AppCode is not implemented "out from the box". But you can easy add it!
Just find "Keymap" in AppCode Preferences, find "DyCI" there and add any hotkey you want ;) AppCode keymap

If your are not sure, that DyCI was installed correctly.
Look at these screenshots.
First, find "External Tools" in AppCode Preferences. Look if "DyCI" is checked. External Tools in AppCode Preferences

Then you can edit its setting.
Be sure, that you have folder ~/.dyci/scripts/ your system and DyCI scripts in it (such as dyci-recompile.py) Path for DyCI script files

#4 Success

If you don't see changes read further

Clone this wiki locally