Add the Viafoura iOS SDK to your app

Add the SDK

Using Cocoapods

  1. In a text editor, open Podfile.
  2. Add pod 'ViafouraCore'
target 'Viafoura-Demo' do
  # Use one of those options
  use_frameworks!
  # use_frameworks! :linkage => :static

  # Pods for Viafoura-Demo
  pod 'ViafouraCore'
end
  1. In terminal go to your project directory then execute pod install --repo-update to install the dependencies added to Podfile.
  2. Open the .xcworkspace file for your project to launch Xcode.

Using Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding Viafoura as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/viafoura/sdk-ios.git")
]

Initialize the SDK

  1. In Xcode, open AppDelegate.swift
  2. Import the Viafoura iOS SDK: import ViafouraSDK
  3. Initialize the SDK in application(application:didFinishLaunchingWithOptions). Make sure to replace SITE_UUID and SITE_DOMAIN with the values corresponding to your domain.
import ViafouraSDK

func application(_ application: UIApplication, 
                                didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]?) -> Bool { 
    ViafouraSDK.initialize(siteUUID: "SITE_UUID", siteDomain: "SITE_DOMAIN")
    return true
}