Class
TchekSdk
public class TchekSdk
This class is the entry point to the Tchek™ SDK
Properties
VERSION
public static var VERSION: String
Methods
configure(key:builder:onCompletion:)
public static func configure(key: String,
builder: TchekBuilder,
onCompletion: @escaping () -> Void)
Initializes the Tchek™ SDK with the provided key and TchekBuilder
Usage:
let builder = TchekBuilder { builder in
builder...
}
TchekSdk.configure(key: "my-tchek-sdk-key", builder: builder)
// SDK is initialized, you can start using it!
Parameters
| Name | Type | Description |
|---|---|---|
| key | String |
The Tchek™ SDK key (mandatory) |
| onCompletion | @escaping () -> Void |
Block called when the configure is ready |
| builder | TchekBuilder |
The builder to customize the global look of the SDK UI |
| Important | It is mandatory to call this method at least once before using the Tchek™ SDK. |
configure(keySSO:builder:onFailure:onSuccess:)
public static func configure(keySSO: String,
builder: TchekBuilder,
onFailure: @escaping (TchekError) -> Void,
onSuccess: @escaping (TchekSSO) -> Void)
Initializes the Tchek™ SDK with the provided key and TchekBuilder
Usage:
let builder = TchekBuilder { builder in
builder...
}
TchekSdk.configure(keySSO: "my-tchek-sdk-sso-key", onCompletion: {}, builder: builder)
// SDK is initialized, you can start using it!
Parameters
| Name | Type | Description |
|---|---|---|
| keySSO | String |
The Tchek™ SDK SSO key (mandatory) |
| onFailure | @escaping (TchekError) -> Void |
Block called when error occurs |
| onSuccess | @escaping (TchekSSO) -> Void |
Block called when the configure is ready with the TchekSSO Object |
| builder | TchekBuilder |
The builder to customize the global look of the SDK UI |
| Important | It is mandatory to call this method at least once before using the Tchek™ SDK. |
loadAllTchek(type:deviceId:search:limit:page:onFailure:onSuccess:)
public static func loadAllTchek(type: TchekScanType?,
deviceId: String?,
search: String?,
limit: Int,
page: Int,
onFailure: @escaping (TchekError) -> Void,
onSuccess: @escaping ([TchekScanLite]) -> Void)
This method load all tchek
Parameters
| Name | Type | Description |
|---|---|---|
| type | TchekScanType? |
The type between Mobile or Device in enum TchekScanType. Pass null for all types |
| deviceId | String? |
The TchekDevice id you want to load. Ignored if type is Mobile |
| search | String? |
The license plate to search |
| limit | Int |
The int indicates the number of tchek to load. Min 50 - Max 250 |
| page | Int |
The int indicate the page to load |
| onFailure | @escaping (TchekError) -> Void |
Block called if an error occurs during loading |
| onSuccess | @escaping ([TchekScanLite]) -> Void |
Block called when the list of tchek is ready |
getReportUrl(tchekId:validity:cost:onFailure:onSuccess:)
public static func getReportUrl(tchekId: String,
validity: Int?,
cost: Bool,
onFailure: @escaping (TchekError) -> Void,
onSuccess: @escaping (String) -> Void)
This method get report url for a Tchek
Parameters
| Name | Type | Description |
|---|---|---|
| tchekId | String |
The TchekScan id you want to load |
| validity | Int? |
The url validity in days. Can be null => infinite |
| cost | Bool |
The boolean indicates that the costs are displayed in the report |
| onFailure | @escaping (TchekError) -> Void |
Block called if an error occurs during loading |
| onSuccess | @escaping (String) -> Void |
Block called when the report url is ready |
shootInspect(builder:)
public static func shootInspect(builder: TchekShootInspectBuilder) -> UIViewController
This method initializes a Shoot/Inspect flow customized with the provided TchekShootInspectBuilder
Usage:
let builder = TchekShootInspectBuilder(delegate: self) { builder in
builder...
}
let viewController = TchekSdk.shootInspect(builder: builder)
// Display the Shoot/Inspect UIViewController
navigationController.pushViewController(viewController, animated: true)
Parameters
| Name | Type | Description |
|---|---|---|
| builder | TchekShootInspectBuilder |
The builder to customize the look of Shoot/Inspect UI elements |
| Returns | A UIViewController to initiate the Shoot/Inspect flow |
shootInspectEnd(tchekId:builder:)
public static func shootInspectEnd(tchekId: String, builder: TchekShootInspectBuilder) -> UIViewController
This method initializes a Shoot/Inspect flow customized with the provided TchekShootInspectBuilder and directly go to the end oh Shoot Inspect to launch a detection
Usage:
let builder = TchekShootInspectBuilder(delegate: self) { builder in
builder...
}
let viewController = TchekSdk.shootInspectEnd(tchekId: "any-tchek-id", builder: builder)
// Display the Shoot/Inspect UIViewController
navigationController.pushViewController(viewController, animated: true)
Parameters
| Name | Type | Description |
|---|---|---|
| tchekId | String |
Id of the Tchek the Shoot Inspect launch a detection |
| builder | TchekShootInspectBuilder |
The builder to customize the look of Shoot/Inspect UI elements |
| Returns | A UIViewController to initiate the Shoot/Inspect flow |
fastTrack(builder:)
public static func fastTrack(builder: TchekFastTrackBuilder) -> UIViewController
This method initializes a FastTrack flow customized with the provided TchekFastTrackBuilder
Usage:
let builder = TchekFastTrackBuilder(delegate: self) { builder in
builder...
}
let viewController = TchekSdk.fastTrack(builder: builder)
// Display the FastTrack UIViewController
navigationController.pushViewController(viewController, animated: true)
Parameters
| Name | Type | Description |
|---|---|---|
| builder | TchekFastTrackBuilder |
The builder to customize the look FastTrack UI elements |
| Returns | A UIViewController to initiate the FastTrack flow |
report(builder:)
public static func report(builder: TchekReportBuilder) -> UIViewController
This method initializes a report screen customized with the provided TchekReportBuilder
Usage:
let builder = TchekReportBuilder(delegate: self) { builder in
builder.btnReportPrevColor = .lightGray
builder.btnReportPrevTextColor = .darkGray
builder.btnReportNextColor = .black
builder.btnReportNextTextColor = .white
builder.reportPagingBg = .orange
builder.reportPagingText = .lightText
builder.reportPagingTextSelected = .white
builder.reportPagingIndicator = .white
}
let viewController = TchekSdk.report(builder: builder)
// Display the report UIViewController
navigationController.pushViewController(viewController, animated: true)
Parameters
| Name | Type | Description |
|---|---|---|
| builder | TchekReportBuilder |
The builder to customize the look of report UI elements |
| Returns | A UIViewController to initiate the report screen |
deleteTchek(tchekId:onFailure:onSuccess:)
public static func deleteTchek(tchekId: String,
onFailure: @escaping () -> Void,
onSuccess: @escaping () -> Void)
This method delete a tchek
Parameters
| Name | Type | Description |
|---|---|---|
| tchekId | String |
Id of the Tchek to delete |
buyBackManager()
public static func buyBackManager() -> TchekBuyBackManager
socketManager(type:device:)
public static func socketManager(type: TchekScanType, device: TchekDevice?) -> TchekSocketManager?
This method initialize a new Socket manager
Parameters
| Name | Type | Description |
|---|---|---|
| type | TchekScanType |
The type between Mobile or Device in enum TchekScanType |
| device | TchekDevice? |
The TchekDevice you want to load. Ignored if type is Mobile |