A step-by-step walkthrough from zero to a working GBGBridge integration. Follow this page in order; each step links to the detailed guide if you need more context.Documentation Index
Fetch the complete documentation index at: https://docs.go.gbgplc.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Xcode 15.0+ with Swift 5.9+
- An iOS project targeting iOS 15.0+
- Access to the GBGBridge SPM package or XCFramework
- A journey URL from the GBG Go Core SDK (see Journey URL)
Step 1: Add the SDK
Add GBGBridge via Swift Package Manager:- Navigate to File > Add Package Dependenciesβ¦
- Enter the GBGBridge package URL.
- Select Up to Next Major Version from
1.0.0. - Click Add Package and ensure
GBGBridgeis linked to your app target.
GBGBridge.xcframework into your project and set it to Embed & Sign.
See Getting Started β Installation for full details.
Step 2: Obtain a journey URL
Your app needs a journey URL to load inside the bridge WebView. This URL is generated server-side using the GBG Go Core SDK β your backend calls the Core SDK, receives a session URL, and passes it to the iOS app.See Journey URL for the full pattern, including URL shape, authentication, and configuration options.
Step 3: Add Info.plist entries
Add usage descriptions for any device capabilities your integration uses:Step 4 β Initialize BridgeHost
Create aBridgeHost β this is the coordinator that routes messages between the WebView and your native code.
Step 5: Set up capture handlers
Attach handlers to the typed capability slots. Setting a handler declares that your app supports that capability β no separate configuration step.Option A: Stub Views (Development / Early Integration)
Use the built-in stub views to prove the bridge works without the SmartCapture SDKs:See Stub Camera Views for details on the stubs and how to swap them for real SDKs.
Option B: SmartCapture SDKs (Production)
Replace the stub views with the GBG SmartCapture document and face camera SDKs. The handler setup is identical β only the view presented insidefullScreenCover changes.
See the SmartCapture Integration Guide (coming soon) for the full walkthrough.
Step 6: Set permission state
Report camera permission state so the web journey can check permissions before attempting capture:Step 7: Display the journey
UseBridgeWebView to load the journey URL. It handles WebView creation, bootstrap script injection, and message handler registration automatically.
See Embedding Guide for SwiftUI and UIKit integration patterns.
Step 8 β Build and Run
- Build and run on a physical device (camera capture requires real hardware).
- The web journey loads in the WebView.
- When the journey reaches a document or selfie step, the bridge sends a capture request.
- Your handler runs, the camera view presents, the user captures, and the result flows back to the web journey.
Verify It Works
Check for these signs of a successful integration:- The web journey loads and renders correctly in the WebView.
capability.queryis handled automatically β the journey knows which capabilities your app supports.- Document capture requests trigger your camera view, and the captured image is returned to the journey.
- Selfie capture requests trigger your selfie view, and the result is returned.
- Cancellation flows work β dismissing the camera sends a
cancelledresponse.
Common Issues
| Symptom | Likely Cause | Fix |
|---|---|---|
| Blank WebView | ATS blocking HTTP URL | Use HTTPS, or add NSAllowsLocalNetworking for local dev |
capability.query returns empty | No handlers set | Set handler on at least one typed slot before loading the URL |
| Camera view never appears | activeRequest not observed | Wire up .onChange(of: host.documentCapture.activeRequest) |
| Capture result not received by journey | complete() not called | Ensure your camera view calls host.documentCapture.complete() on every exit path |
See Troubleshooting for a comprehensive diagnostic guide.
Complete Minimal Example
Putting it all together β a minimal SwiftUI app that loads a journey and handles document capture with a stub view:See Hello Journey for the full annotated example.
Whatβs Next
Once the basic integration is working:- Add selfie capture β same pattern as document capture, using
host.selfieCapture. - Add custom capabilities (NFC, biometrics) β see Capability Handling.
- Replace stub views with SmartCapture SDKs for production-quality capture.
- Review the Security Guide before shipping to production.