Initialization - Standard Experience
Start the SDK and navigate the user to the Home view
Definition
extension ReadyRemit {
public func startSDK(
configuration: ReadyRemitConfiguration = .init(),
themeConfiguration: String? = nil,
fetchAccessTokenDetails: @escaping () async throws -> AccessTokenDetails,
verifyFundsAndCreateTransfer: @escaping (TransferRequest) async throws(ReadyRemitError) -> TransferDetails,
onLaunch: (() -> Void)? = .none,
onDismiss: (() -> Void)? = .none,
onLoad: @escaping (AnyView) -> Void
) {
...
// onLaunch() is called when sdkView appears
onLoad(sdkView)
}
}Parameters
| Property | Type | Description |
|---|---|---|
| configuration | ReadyRemitConfiguration | The options available for customizing a branded experience |
| themeConfiguration | String? | (Optional) A JSON string that customizes the visual appearance of the SDK. |
| fetchAccessTokenDetails | () async throws -> AccessTokenDetails | Called to acquire an access token for the SDK to communicate with the ReadyRemit API on behalf of the sender |
| verifyFundsAndCreateTransfer | (TransferRequest) async throws(ReadyRemitError) -> TransferDetails | Called to verify sender funds and create the transfer |
| onLaunch | (() -> Void)? | Called when the SDK has fully launched |
| onDismiss | (() -> Void)? | Called when the SDK has been closed |
| onLoad | (AnyView) -> Void | Called when the SDK has completed setup returning the SDK View |
Sample Usages
private let configuration: ReadyRemitConfiguration = .init()
private func fetchAccessTokenDetails() async throws -> AccessTokenDetails {
...
}
private func verifyFundsAndCreateTransfer(
transferRequest: ReadyRemit.TransferRequest
) async throws(ReadyRemitError) -> TransferDetails {
...
}
private func onLaunch() {
print("ReadyRemit SDK launched")
}
private func onDismiss() {
print("ReadyRemit SDK dismissed")
}
private func onLoad() { [weak self] sdkView
// navigate to sdkView
}
ReadyRemit.shared.startSDK(
configuration: configuration,
fetchAccessTokenDetails: fetchAccessTokenDetails,
verifyFundsAndCreateTransfer: verifyFundsAndCreateTransfer,
onLaunch: onLaunch,
onDismiss: onDismiss,
onLoad: onLoad
)private let themeConfiguration = """
{
"foundations": {
"colorPrimary": { "light": "#42CB91", "dark": "#42CB91" },
"fontFamily": "inter"
},
"components": {
"button": {
"buttonRadius": 8,
"buttonTextCase": "capitalize"
}
}
}
"""
ReadyRemit.shared.startSDK(
themeConfiguration: themeConfiguration,
fetchAccessTokenDetails: fetchAccessTokenDetails,
verifyFundsAndCreateTransfer: verifyFundsAndCreateTransfer,
onLoad: { sdkView in
// navigate to sdkView
}
)Updated 8 days ago
