Validic Mobile Library

Installation

The Validic Bluetooth, HealthKit and OCR frameworks are dependant on the Core framework.

Copy ValidicCore, ValidicBluetooth, ValidicHealthKit, ValidicOCR and copy-validicmobile.rb files to the same folder where your Xcode project file (xcodeproj) is located.

Frameworks in Project Root

In Xcode, open your project and select your target.

Target Selected

In the General tab there will be two sections at the bottom of the screen labeled Linked Frameworks and Libraries and Embedded Binaries. Add the frameworks to the project by clicking the + button under the Embedded Binaries section.

Select Add Other.. from the drop down menu.

Copy Items

You should now see each framework added under Linked Frameworks and Libraries, Embedded Binaries and in the file browser on the left. Your project should look like the image below after importing the frameworks to the Xcode project.

Linked Frameworks

In the “Build Phases” tab add a new build phase by clicking the + button at the top and selecting “New Run Script Phase”.

Build Phase

In the new phase’s text area paste in ruby copy-validicmobile.rb.

Copy Script

In the Build Settings tab search for Enable Bitcode option and make sure it’s set to YES.

Enable Bitcode

NOTE: in new projects Bitcode is enabled by default and at some point will be required by Apple. If you are working with other frameworks that are NOT Bitcode enabled, Enabled Bitcode option should be set to No.

Bridging with Swift

To use the frameworks with Swift, you will need to add a Bridging Header. In Xcode go to the File menu and under New select File (cmd+N). In the New File dialog box choose “Header File”.

Header File

Name the header file “[ProjectName]-Bridging-Header.h”.

Select ProjectName-Bridging-Header.h and add the following lines

#import <ValidicCore/ValidicCore.h>
#import <ValidicBluetooth/ValidicBluetooth.h>
#import <ValidicOCR/ValidicOCR.h>
#import <ValidicHealthKit/ValidicHealthKit.h>

Then go to the build settings of your target and search for the Swift Compiler section and double click on the Objective-C Bridging Header field. In the dialog box that appears enter the name of the bridging header file ProjectName-Bridging-Header.h.

Bridging Header

Test Installation

At this point installtion of the frameworks is finished, lets do a test to make sure the project can find and complie the frameworks. Open the projects AppDelegate.swift file. At the top of the file add the following

import ValidicCore

Now add a print statement in the application:didFinishLaunchingWithOptions function

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        print(VLDSession.libraryVersion())
        return true
    }

In the console you should see the library version printed out

library-version