I have started learning about Leap Motion and decided to make a simple app in Objective C in order to test it. The first thing I realise it is that there is no template for Objective C, nor a guide of how to integrate the lib and setup the project. So here I will show how to set up an OS X project, and also I will provide a template.
- Once you create your project, drag and drop
LeapObjectiveC.mminto your project and check “Copy items into destination group’s folder (if needed)”. Also check that files are added to your main target and “Create groups for any added folders” is selected.
libLeap.dylibinto your project folder.
- Select your project and add
libLeap.dylibas a required framework.
- Now let’s create a new Build Phase in order to copy libLeap.dylib into the executable. Go to your main target, click on “Build Phases” and add a “Copy Files Build Phase”. The destination must be set to “Executables”.
- Last, but not least, go to “Build Settings”, look for “C++ Standard Library” and make sure “libstdc++ (GNU C++ standard library)” is selected.
The class EALeapMotionController implements the interface LeapDelegate where all the events are handled.
Download template project