Hey everyone, Has anyone implemented AppIntent/App...
# multiplatform
s
Hey everyone, Has anyone implemented AppIntent/AppShortcuts using KMP? I have a question about it—would appreciate your input! https://stackoverflow.com/questions/79535191/ios-appintent-open-app-when-run-not-working-in-kmp
f
Hey, Steve. Any luck with this? đź‘€
s
No @Fernando, will notice you when I do
f
I will try to give it a shot later on. But just to be clear, this if for CMP, not only for KMP, right? If so, and if this is your implementation of the iOS code, I think you are missing the actual logic to navigate to the desired route, in the
perform
funciton you should open the app and perform the navigation.
Copy code
@available(iOS 16, *)
struct AddNewItemAppIntent: AppIntent {
    
    static var title: LocalizedStringResource = "Add New Item"
    
    static var description = IntentDescription("Open directly to add new Item in ABC")

    static var openAppWhenRun: Bool = true
    
    @MainActor
    func perform() async throws -> some IntentResult {
        return .result()
    }
}
🙌 1
s
right, this for CMP. I can't navigate in the perform function, because it's swift and my navigation is Kotlin compose, so what I can do here is • Save the target screen -> open app -> check the saved screen -> navigate to the target screen
Let me know if you have a better way to do it
hi, @Fernando, did you tried it?
@Fernando hi
f
Hi @stevie I did give it a try with Compose Navigation, but no luck due to lack of deeplink handling. However, I think decompose has support for deeplinks
s
But does the shortcut able to open the app? My implementation can get the app open