This guide is a short tutorial on how to install the Virgil SDKThe SDK helps take tedious complexity out of coding by providing APIs for all of Virgil Services..
Virgil Security provides a set of APIs for adding security to any application. In a few simple steps, you can encrypt communication, securely store data, provide passwordless logins, and ensure data integrity.
The Virgil SDK is a communication gateway between your application and Virgil ServicesVirgil Services is a group of cryptographic services that make up the Virgil Security infrastructure more ....
The Virgil SDK is provided as a framework named VirgilSDK. The package is distributed via Carthage and CocoaPods
INSTALLING THE PACKAGE
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
To integrate VirgilSDK into your Xcode project using CocoaPods, specify it in your Podfile:
platform :ios, '10.0'
target '' do
pod 'VirgilSDK', '~> 4.5.0'
Then, run the following command:
> CocoaPods 0.36+ is required to build VirgilSDK 4.0.0+.
As of version 4.2.0 VirgilSDK is available for integration using Carthage.
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate VirgilSDK into your Xcode project using Carthage, perform following steps:
- Create an empty file with name Cartfile in your project's root folder, that lists the frameworks you’d like to use in your project.
- Add the following line to your Cartfile
github "VirgilSecurity/virgil-sdk-x" ~> 4.5.0
- Run carthage update. This will fetch dependencies into a Carthage/Checkouts folder inside your project's folder, then build each one or download a pre-compiled framework.
- On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, add each framework you want to use from the Carthage/Build folder inside your project's folder.
- On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
Although VirgilSDK pod is using Objective-C as its primary language it might be quite easily used in a Swift application.
All public API is available from Swift and is bridged using NS_SWIFT_NAME where needed.
If you want to use VirgilSDK from swift it is necessary to perform the following:
- Create a new header file in the Swift project.
- Name it something like BridgingHeader.h
- Put there the following lines:
- In the Xcode build settings find the setting called Objective-C Bridging Header and set the path to your BridgingHeader.h file. Be aware that this path is relative to your Xcode project's folder. After adding bridging header setting you should be able to use the SDK.
You can find more information about using Objective-C and Swift in the same project here.