iOS SDK Reference
Class CredoAppService.Builder
CredoAppService.BuilderCredoAppService.Builder is responsible for creating the CredoAppService class instance
CredoAppService.Builder()Method CredoAppService.Builder.addModule(module: Module)
CredoAppService.Builder.addModule(module: Module)addModule(module: Module) : CredoAppService.BuilderThe method adds a module to the builder configuration
Parameters:
| Name | Description | Type |
|---|---|---|
module | Requires one of the following modules | Module |
Returns:
credoapp.CredoAppService.Builder
Method CredoAppService.Builder.setForceResolvePermissions(value)
CredoAppService.Builder.setForceResolvePermissions(value)setForceResolvePermissions(force: Bool) : CredoAppService.Builder
- If
truethen SDK requests permissions automatically otherwise, SDK omits requesting permissions - The default value is
true
Parameters:
| Name | Description | Type |
|---|---|---|
value | Requires Bool value true or false | Bool |
Returns:
credoapp.CredoAppService.Builder
Method CredoAppService.Builder.addPlugin(plugin: Plugin)
CredoAppService.Builder.addPlugin(plugin: Plugin)addPlugin(plugin: Plugin) : CredoAppService.BuilderThe method adds a plugin to the builder configuration
Parameters:
| Name | Description | Type |
|---|---|---|
plugin | Requires one of the following plugins | Plugin |
Returns:
credoapp.CredoAppService.Builder
Method CredoAppService.Builder.build()
CredoAppService.Builder.build()build() : CredoAppServiceReturns:
configured CredoAppService instance
Class CredoAppService
CredoAppServicecredoapp.CredoAppService CredoAppService is responsible for capturing a client's digital footprint
Method CredoAppService.collect()
CredoAppService.collect()collect() : CredoAppResult<String>- Collects from the device and returns locally
- This method must not be called on the UI thread
- It does not accept any parameters
Returns:
Type | Description |
|---|---|
| If the |
| Returns an error if something goes wrong. |
Class CredoAppResult<T>.Success
CredoAppResult<T>.SuccessCredoAppResult.Success enum states for successful operation and may contain a value
Fields:
| Field Name | Type | Description |
|---|---|---|
value | T | Returns value of generic type. |
ClassCredoAppResult.Error
CredoAppResult.ErrorCredoAppResult.Error states for operation fail and contains error details
Fields:
| Field Name | Type | Description |
|---|---|---|
message | String | Returns the message value of the error. |
code | Int | Returns the code value of the error |
Class BehavioralModule
BehavioralModuleBehavioralModuleBehavioralModule is responsible for capturing a client's behavioral interaction with UI and OS.
The special module is responsible for observing and extracting in-app user behavior data. Tracking must be initiated manually. The module doesn’t compatible with Swift UI tooling.
Method BehavioralModule.startTracking()
BehavioralModule.startTracking()startTracking()- Starts behavioral interaction metadata tracking
Method BehavioralModule.stopTracking()
BehavioralModule.stopTracking()stopTracking()- Terminates behavioral metadata tracking
Method BehavioralModule.setLogger(plugin: Plugin)
BehavioralModule.setLogger(plugin: Plugin)setLogger(plugin: Plugin)- Accepts LoggingPlugin() to log any errors that may occur while event tracking
How to use BehavioralModule
It is necessary to call the BehavioralModule.startTracking() method before proceeding to complete the application form. The example is below
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
BehavioralModule.setLogger(plugin: LoggingPlugin())
BehavioralModule.startTracking()
...
}
}Then pass BehavioralModule instance to CredoAppService to collect behavioral data along with other data
class SubmitController: UIViewController {
func submit() {
DispatchQueue.global().async {
let credoAppService = CredoAppService.Builder()
// add other modules
.addModule(BehavioralModule())
.build()
let result = credoAppService.collect()
// send dataset to the credolab server
}
}
}
Highly recommendedFor successful integration, we strongly recommend assigning the accessibilityIdentifier attributes to emphasize a specific logical control or element that holds significance within the User Flow of your app.
How to set
accessibilityIdentifier?
- Open the storyboard interface builder
- Select an element using the main view or from the tree view on the left
- Switch to “Identity inspector”
- In the “User Defined Runtime Attributes”, click the plus button and change the following:
- Replace KeyPath with
accessibilityIdentifier- Change the type to
string- Set the value to what you want the Accessibility ID to be. For example,
submit_button
See more examples in our Behavioral Module Identifiers Guide (iOS)
Error Codes
| Status Code | Reason | Description |
|---|---|---|
| 30 | Duplicated areas error | The extracting areas are duplicated. |
| 90 | Unknown error | An unexpected error occurred. |
Updated 6 months ago
