iOS SDK Reference

Class CredoAppService.Builder

CredoAppService.Builder is responsible for creating the CredoAppService class instance

CredoAppService.Builder()

Method CredoAppService.Builder.addModule(module: Module)

addModule(module: Module) : CredoAppService.Builder

The method adds a module to the builder configuration

Parameters:

NameDescriptionType
moduleRequires one of the following modulesModule

Returns:

credoapp.CredoAppService.Builder


Method CredoAppService.Builder.setForceResolvePermissions(value)

setForceResolvePermissions(force: Bool) : CredoAppService.Builder

  • If true then SDK requests permissions automatically otherwise, SDK omits requesting permissions
  • The default value is true

Parameters:

NameDescriptionType
valueRequires Bool value true or falseBool

Returns:

credoapp.CredoAppService.Builder


Method CredoAppService.Builder.addPlugin(plugin: Plugin)

addPlugin(plugin: Plugin) : CredoAppService.Builder

The method adds a plugin to the builder configuration

Parameters:

NameDescriptionType
pluginRequires one of the following pluginsPlugin

Returns:

credoapp.CredoAppService.Builder


Method CredoAppService.Builder.build()

build() : CredoAppService

Returns:

configured CredoAppService instance



Class CredoAppService

credoapp.CredoAppService CredoAppService is responsible for capturing a client's digital footprint

Method 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:

TypeDescription
CredoAppResult<String>If the collect method is succeeded, returns the string, which represents the array of bytes that is encoded to the base64 string
CredoAppResult.ErrorReturns an error if something goes wrong.
Please refer to the error codes table.



Class CredoAppResult<T>.Success

CredoAppResult.Success enum states for successful operation and may contain a value

Fields:

Field NameTypeDescription
valueTReturns value of generic type.



ClassCredoAppResult.Error

CredoAppResult.Error states for operation fail and contains error details

Fields:

Field NameTypeDescription
messageStringReturns the message value of the error.
codeIntReturns the code value of the error



Class BehavioralModule

BehavioralModule

BehavioralModule 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()

startTracking()
  • Starts behavioral interaction metadata tracking

Method BehavioralModule.stopTracking()

stopTracking()
  • Terminates behavioral metadata tracking

Method 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 recommended

For 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?

  1. Open the storyboard interface builder
  2. Select an element using the main view or from the tree view on the left
  3. Switch to “Identity inspector”
  4. In the “User Defined Runtime Attributes”, click the plus button and change the following:
    1. Replace KeyPath with accessibilityIdentifier
    2. Change the type to string
    3. 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 CodeReasonDescription
30Duplicated areas errorThe extracting areas are duplicated.
90Unknown errorAn unexpected error occurred.