Skip to content

Connect to SWIFT

aumentia edited this page Sep 3, 2015 · 1 revision

The Visual Search Framework is written in Objective C. In order to connect it to your Swift app follow these steps:

  • Import the VS.framework by dragging and dropping it into an Xcode 6 Swift project.

  • Create a new Objective C file in your project (File->New->File [Objective C for iOS]).

  • Accept the prompt to create a bridging header file between Objective C and Swift.

  • Delete the newly created Objective C file but retain the bridging header file ${YOURPROJ}-Bridging-Header.h.

  • In the Bridging header file, import the VS.framework using the standard Objective C import syntax. You will need to import as well all the dependencies of the framework.

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreVideo/CoreVideo.h>
#import <CoreGraphics/CoreGraphics.h>
#import <QuartzCore/QuartzCore.h>
#import <Accelerate/Accelerate.h>
#import <CoreMotion/CoreMotion.h>
#import <AVFoundation/AVFoundation.h>

#import <VS/VS.h>
  • Set Build Settings -> Packaging -> Defines Module to Yes

  • Add Build Phases -> Link Binary With Libraries -> libstdc++.6.0.9.dylib