Rinku icon indicating copy to clipboard operation
Rinku copied to clipboard

[Question] iOS Setup

Open Ric-AB opened this issue 1 year ago • 4 comments

how do we setup the library on iOS if we have something like this. I didn't see any example Screenshot 2024-08-13 at 21 28 13

Ric-AB avatar Aug 13 '24 20:08 Ric-AB

First, you need to set up the deeplink and universal links in your app, and judging by the code that you posted, I assume you did not complete this part of the process. I do not cover this step in the documentation because there are tons of tutorials online.

here you can find links for both platforms: https://github.com/theolm/Rinku#initial-setup


But as a guideline basically, you need to:

1- Configure deeplinks and universal links in your app, so your application can receive the deeplink from the system and the Rinku can treat it. btw, I think you will need to create an app delegate for that. 2- Create an instance a Rinku instance inside the app delegate 3- Inside the appdelegate, implemented the functions to receive the deeplink and with the URL received call rinku.onDeepLinkReceived(url: urlReceived)

theolm avatar Aug 14 '24 13:08 theolm

I don't have time now, but I'll work on a sample for your case. Meanwhile, I think if you use an appdelegate adapter: https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-an-appdelegate-to-a-swiftui-app

You should be able to copy the appdelegate from the readme (or from the sample).

I'll keep the issue open for now.

theolm avatar Aug 14 '24 14:08 theolm

Thanks for pointing me in the right direction. My major problem now is accessing RinkuIos in the AppDelegate file. I've exported the dependency and used api declaration like the installation guide states and imported the shared module, but for some reason it still doesn't recognise RinkuIos, so I was wondering if there is anything specific I need to do in Xcode

Ric-AB avatar Aug 14 '24 21:08 Ric-AB

Could you provide a sample of your code?

theolm avatar Aug 18 '24 21:08 theolm

so this is the delegate class you suggested and what i tried to do is create a wrapper class in my iosMain sourceset where i just forward the calls down to Rinku. I haven't been able to test it out yet, but i hope it works. Screenshot 2024-08-22 at 16 17 37

Ric-AB avatar Aug 22 '24 15:08 Ric-AB

I would have to check your project setup. Do you have a repository with the code? Did you exported rinku to the ios framework?

kotlin {
    ...
    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
        // Specify iOS targets
    ).forEach { iosTarget ->
        iosTarget.binaries.framework {
            // Export of Rinku library to the iOS framework
            export("dev.theolm:rinku:<latest_version>")
            ...
        }
    }
    ...
    sourceSets {
        commonMain.dependencies {
            api("dev.theolm:rinku:<latest_version>")

            // For compose multiplatform projects
            implementation("dev.theolm:rinku-compose-ext:<latest_version>")
        }
    }
}

The api and the export are required so you can access the lib in the ios code.

theolm avatar Aug 22 '24 19:08 theolm

closing for inactivity

theolm avatar Sep 07 '24 23:09 theolm

Hi @theolm i have the same issues i did all the steps api and export in the ios block but i still, face the same issue

AndroidPoet avatar Jul 28 '25 14:07 AndroidPoet

Please provide a sample so I can understand what is happening.

theolm avatar Jul 28 '25 16:07 theolm