Add the Viafoura iOS SDK to your app
Add the SDK
Using Cocoapods
- In a text editor, open Podfile.
- 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
- In terminal go to your project directory then execute
pod install --repo-update
to install the dependencies added to Podfile. - 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
- In Xcode, open AppDelegate.swift
- Import the Viafoura iOS SDK:
import ViafouraSDK
- 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
}
Updated over 1 year ago
What’s Next