New project setup using kushki-ios-arm 🍎#
This article will guide you through the configuration of the Kushki library for an ARM processor (Apple Silicon M1/M2/M3). This will allow you to perform tests on physical devices or simulators.Please follow these steps in exact order to ensure a successful build.
1. Create a new project in Xcode#
A. Select App.
B. Give it a name and the organization identifier. In this case, we will use the name TestKushkiLib.
C. Select the place where we are going to save the new project (this will create a local git repository).
2. Create a Podfile#
A. Open a terminal at the root of your project and create a Podfile with the command:B. Open the newly created Podfile and place the kushki-ios-arm library as a dependency. Additionally, you must set the platform variable to ios, '14.3'.Here is the complete example:C. Run the install command in the terminal inside the folder where our Podfile is located:4.
Close Xcode and open the TestKushkiLib.xcworkspace file (white icon) that was created. This contains both your project and the link to the pods.
3. Add Visa and Mastercard libraries#
A. Copy the MastercardSonic.xcframework and VisaSensoryBranding.xcframework libraries into your main TestKushkiLib folder (via Finder).B. In Xcode, go to the TestKushkiLib project (left bar) -> TARGETS → TestKushkiLib -> Build Phases. In the Link Binary With Libraries section, drag and drop the Visa and Mastercard libraries you just copied.C. Now, go to the Pods project (left bar) -> TARGETS → kushki-ios-arm -> Build Phases. In the Link Binary With Libraries section, click on the + sign and add the Visa and Mastercard libraries there as well.
4. Set up the project#
A. Go to TestKushkiLib project -> TARGETS → TestKushkiLib -> Build Settings.
B. Search for the term sandboxing.
C. Set the User Script Sandboxing property to No.D. Go to TestKushkiLib project -> TARGETS → TestKushkiLib -> General.
E. In the Framework, Libraries and Embedded Content section, ensure the MastercardSonic.xcframework library is set to Embed & Sign.5. Change the Cardinal framework#
You must replace the Cardinal framework manually inside the Pods folder for the project to compile correctly on ARM simulators.
A. Navigate to this path in your project folder:
TestKushkiLib/Pods/kushki-ios-arm/Frameworks
B. Delete the existing CardinalMobile.framework folder.
C. Extract the contents of the attached zip CardinalMobileiOSXC.zip.
D. Go to the path CardinalMobile.xcframework/ios-arm64 from the extracted zip.
E. Copy the CardinalMobile.framework folder found there.
F. Paste it back into your project path: TestKushkiLib/Pods/kushki-ios-arm/Frameworks.
In the ContentView.swift file of your project, add a button with the token request code to test the integration.7. Run the simulation 📲#
Select your target simulator (e.g., iPhone 15) and press Run (Cmd + R). Click the "Charge" button and check the console for the transaction result.