Getting Started
This guide will help you to get started with the SDK. The SDK is a set of tools that allows you to interact with the API.
Integrating the SDK
Install CocoaPods
- Install CocoaPods (if not installed):
sudo gem install cocoapods - Navigate to your project folder in Terminal:
cd /path/to/YourProject - Initialize CocoaPods:
pod init
Configure Podfile
Edit the generated Podfile:
platform :ios, '15.5'
target 'YourAppTargetName' do
use_frameworks!
use_modular_headers!
# InstaVision SDK pod (Ignore the tag to use latest version)
pod 'IVSDK', :git => 'git@github.com:InstaViewAI/IVSDK-iOS.git', :tag => '<Version number to be installed>'
end
Install Pods
Run:
pod install
Then, always open the .xcworkspace file (not .xcodeproj).
Initialize InstaSDK
Add InstaSDK configuration to your app.
If using UIKit AppDelegate:
import UIKit
import IVSDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Replace partnerId with your partner id
InstaSDK.shared.configure(partnerId: partnerId)
// Set app evvironment to Prod/Staging
InstaSDK.shared.setEnvironment(.prod)
// Set app region to us
InstaSDK.shared.setRegion(.us)
return true
}
}
If using SwiftUI lifecycle:
import SwiftUI
import IVSDK
@main
struct YourApp: App {
init() {
// Replace partnerId with your partner id
InstaSDK.shared.configure(partnerId: partnerId)
// Set app evvironment to Prod/Staging
InstaSDK.shared.setEnvironment(.prod)
// Set app region to us
InstaSDK.shared.setRegion(.us)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}