Can some one guide me on how to integrate razorpay...
# compose-ios
v
Can some one guide me on how to integrate razorpay with cmp for ios
🧵 2
use their xcframework with this method
v
Okay
🧵 2
Thanks I am going to look into this
Yes this worked but while importing it in the iosMain sourceset i have to use the import with com.varun.practise.RazorpayCheckout like this but if i want to do like import Razorpay as done normally while working with Razorpay in iosApp if there is way around it let me know because i tried changing the package name in the .def it was then unable to be imported as it had no reference to it. One last thing while ingerating the framework in the iosFrameworks directory which i had put in the root directory i was facing issues with the .xcframework because it was uable to detect the header file even if the given path was correct so what I am doing now is that i have copied only the framework for the simulator and put in the iosFramework and I am linking to the header of it needed help here so that I am able to use it for the ios-arm64 i.e. iphone device also.
🧵 1
j
then you need to link the .framework in xcode like other libraries.
p
The easiest way is to do the swift side using swift and call your classes from Kotlin. You can even expose a swiftui component or a Uikit ViewController that wraps the RazorPay SDK and call it from compose. If all you need is call that SDK and receive a token back or something. I would encapsulate the SDK in a UiKit UiViewController and call it from compose.
Other alternatives like objc interop will take you forever if it is a big SDK.
j
@Pablichjenkov you're right. it is taking a lot of time to index. And also my m1 air just get stuck when trying to use Android Studio Intellisens
p
Way easier to just create a "thin" wrapper implementation in swift and inject it in KMP using koin or any other DI framework.
v
can someone explain me what is a this wrapper implementation in swift which i have to inject using koin
j
I think @Pablichjenkov was talking about creating an interface in kotlin then implement it in swift then define it in koin setup. So, you can get the object anywhere in the project using the interface
☝️ 1
v
is it related to expect and actual?
j
@Varun Sethi no. I think you need to explore some libraries that has done multiplatform works
v
Okay let me give some time on it if i am able to figure it out I will let you know mean time if possible you can also do the same.
🦾 1
p
Read this article for an intro to the technique i referred to: https://medium.com/p/69dbc9a841a2 Expect/Actual is limited to the classes and symbols you can access in iOSMain only. Your situation is that you want to access Swift code. Unfortunately you can access pure Swift code from iOSMain yet. Read the article above for an intro, Then you can also check this project where I apply such technique to consume Firebase as SPM dependency only: https://github.com/pablichjenkov/macao-marketplace