To install the HSBCPaymentsSDK into your application via Swift Package Manager follow two steps:
- Installing Assets Plugin
- Installing HSBCPaymentsSDK
Following sections describe how to complete above steps
HSBCPaymentsSDK depends on certain assets to function. These are available over the air and are supposed to be present while building the SDK. The Assets Plugin is a build time dependency that downloads all required assets and ensures the availability of the latest assets at build time.
To install Assets Plugin follow the below steps:
In Xcode, go to the menu and select Product → Scheme → Edit Scheme….
Alternatively, you can select your target from the scheme drop-down in Xcode's toolbar and choose Edit Scheme....
In the Scheme Editor, expand Build and select Pre-actions.
Add a New Run Script Action.
Select the app target for Provide build settings from
Paste the below shell script:
if [[ "${ACTION}" == "clean" ]]; then
cd "${PROJECT_DIR}"
echo "Running Fuse.rb script..."
ruby "${BUILD_DIR%Build/*}SourcePackages/checkouts/hsbc-ios/Sources/HSBCPaymentsSDK/Fuse.rb"
fi
This Script will be executed whenever you do Clean Build Folder.
The HSBCPaymentConfig.json contains the clientIds which helps the Assets plugin to download assets specific to your application. Create a .json file named HSBCPaymentConfig.json inside the app directory of your project. Add clientConfigs to this file. Please note to add this to the folder where the project file is present.
Sample:
{
"clientConfigs": {
"your-client-id": {}
}
}
Add HSBCPaymentsSDK to your project using Xcode:
-
Open your project in Xcode
-
Go to File → Add Package Dependencies
-
Enter the package URL:
https://github.com/yourorg/hsbc-ios.git
-
Select the version you want to use
-
Add the package to your target
Or add it to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/juspay/hsbc-ios.git", from: "1.0.0")
]
This project is licensed under the MIT License - see the LICENSE file for details.