Truv iOS SDK
Integrate Truv Bridge into your iOS app.
Overview
- Installation — Swift Package Manager and CocoaPods setup
- Bridge — embed Truv Bridge and handle events
- Order — embed a Truv Order and handle events
See also:
- Package on CocoaPods — SDK on CocoaPods
- SDK on GitHub — SDK source and Swift Package Manager repository
- Demo app on GitHub — runnable sample app where you can try Bridge and Order with your own keys and explore the integration code
Installation
Swift Package Manager
- In Xcode, go to File → Add Package Dependencies
- Enter the package URL:
https://github.com/truvhq/ios-sdk.git - Select the version and add
TruvSDKto your target
CocoaPods
CocoaPods trunk becomes read-only on December 2, 2026 — no new library versions can be published after that date. Truv plans to stop publishing CocoaPods updates in December 2026. Existing installs will continue to work, but Swift Package Manager is recommended for new projects.
Add to your Podfile:
pod 'TruvSDK'Then run:
pod installBridge
Use TruvBridgeController to present the Truv Bridge as a full-screen flow.
Initialization
TruvBridgeController(
token: String,
delegate: TruvDelegate? = nil
)Presenting the Bridge
import TruvSDK
class ViewController: UIViewController {
func openBridge(token: String) {
let bridge = TruvBridgeController(token: token, delegate: self)
bridge.modalPresentationStyle = .fullScreen
present(bridge, animated: true)
}
}
extension ViewController: TruvDelegate {
func onEvent(_ event: TruvEvent) {
switch event {
case .onLoad:
// Bridge finished loading
break
case .onClose:
// User closed the Bridge
break
case .onSuccess(let payload):
// Called when the Bridge closes after a successful task.
// payload?.publicToken — use this to retrieve data server-side.
// payload?.metadata.taskId — the task identifier.
break
case .onEvent(let payload):
// Lifecycle event. For the full list of event types and
// their payloads, see:
// https://docs.truv.com/docs/event-reference-for-truv-bridge#onevent-types
// Field names may slightly differ — check the exported Swift types.
break
}
}
}Order
Use TruvOrderController to present an embedded Order — a customizable verification workflow that supports multiple data sources and product types.
Initialization
TruvOrderController(
token: String,
delegate: TruvOrderDelegate? = nil
)Presenting an Order
import TruvSDK
class ViewController: UIViewController {
func openOrder(token: String) {
let order = TruvOrderController(token: token, delegate: self)
order.modalPresentationStyle = .fullScreen
present(order, animated: true)
}
}
extension ViewController: TruvOrderDelegate {
func onOrderEvent(_ event: TruvOrderEvent) {
switch event {
case .load:
// Order page finished loading
break
case .close:
// User closed the Order
break
case .success:
// A task within the Order completed successfully.
// The Order is still open at this point — it may show
// a success screen or a self-certification screen
// depending on the configuration.
break
case .completed:
// The entire Order is complete (all tasks finished)
break
}
}
func onBridgeEvent(_ event: TruvEventPayload) {
// Fired when the user interacts with the Bridge for a
// sub-order (task) within the Order.
// Equivalent to TruvDelegate.onEvent(.onEvent(payload)).
// See: https://docs.truv.com/docs/event-reference-for-truv-bridge#onevent-types
}
}Updated 5 days ago