This guide covers how to add the Persona Sentinel SDK to your iOS project and how to use the SDK.
Requirements
Your application needs a minimum deployment target of iOS 15 or higher.
Adding Persona to your project
Install via Swift Package Manager
- Select your project’s Swift Packages tab.
- Click the + to add a package.
- Add the repository URL
https://github.com/persona-id/sentinel-ios.git, and click Next. - Choose the package options version rule you want to use. Persona recommends the default (up to next major version), and click Next.
- Check that the package is being added to the right target, and click Finish.
Install via CocoaPods
To install the SDK with CocoaPods, add PersonaSentinel as one of your target dependencies in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
target 'Your Project' do
pod 'PersonaSentinel'
end
Versioning
If you’re also using the Inquiries iOS SDK, make sure both implementations use the same version of the SDK.
Usage
The Persona Sentinel SDK collects passive signals from customers via events. The following sections describe how to configure and trigger a Sentinel event.
Triggering a Sentinel event
The Sentinel object is used to build and trigger an event.
Sentinel
.builder(
clientToken: CLIENT_TOKEN,
transactionTypeId: TRANSACTION_TYPE_ID,
)
.context() // an optional string
.identifiers() // an optional array of strings
.environmentId() // an optional Persona environment ID: defaults to your production environment.
.accountReferenceId("...") // optionally include account reference id for this event
.autoCreateAccount(true) // an optional boolean: defaults to true. Controls whether an account is automatically created.
.autoCreateAccountTypeId("acttp_...") // an optional account type token: defaults to the transaction type's configured default account type.
.build()
.trigger { result in
switch result {
case .success(let successData):
// log or do something
break
case .failure(let error):
// log or do something
break
}
}
You can trigger events using trigger() or triggerAsync() for an awaitable interface.