Hi <@UHAJKUSTU> Getiing this error please help, st...
# decompose
s
Hi @Arkadii Ivanov Getiing this error please help, stuck since long
Cannot find type 'LifecycleRegistry' in scopeShowing All Messages
SwiftCompile normal arm64 Compiling\ LifecycleHolder.swift /Users/shivamkanodia/Downloads/rb-android/android/rdash/rdash/LifecycleHolder.swift (in target 'rdash' from project 'rdash')
/Users/shivamkanodia/Library/Developer/Xcode/DerivedData/rdash-hjfmfxolvdblalgmghhhmonijesf/Index.noindex/DataStore -index-system-modules
/Users/shivamkanodia/Downloads/rb-android/android/rdash/rdash/LifecycleHolder.swift:6:20: error: cannot find type 'LifecycleRegistry' in scope
let lifecycle: LifecycleRegistry
^~~~~~~~~~~~~~~~~
/Users/shivamkanodia/Downloads/rb-android/android/rdash/rdash/LifecycleHolder.swift:9:21: error: cannot find 'LifecycleRegistryKt' in scope
lifecycle = LifecycleRegistryKt.LifecycleRegistry()
^~~~~~~~~~~~~~~~~~~
/Users/shivamkanodia/Downloads/rb-android/android/rdash/rdash/LifecycleHolder.swift:6:20: Cannot find type 'LifecycleRegistry' in scope
/Users/shivamkanodia/Downloads/rb-android/android/rdash/rdash/LifecycleHolder.swift:9:21: Cannot find 'LifecycleRegistryKt' in scope
wrote this in bhild.gradle file
Copy code
cocoapods {
    summary = "Rdash the Shared Module"
    homepage = "Link to the Shared Module homepage"
    version = "1.0"
    ios.deploymentTarget = "14.1"
    podfile = project.file("../rdash/Podfile")
    framework {
        baseName = "kmm"
        isStatic = true

        export(ArkIvanov.Decompose.decompose)
        export(ArkIvanov.Essenty.lifecycle)
    }
}
when building ios app
a
Did you import your framework in
LifecycleHolder.swift
file?
Also, what versions of Decompose and Essenty are you using in your project?
s
yes
Copy code
import kmm
import SwiftUI

class LifecycleHolder : ObservableObject {
    let lifecycle: LifecycleRegistry
    
    init() {
        lifecycle = LifecycleRegistryKt.LifecycleRegistry()
        
        lifecycle.onCreate()
    }
    
    deinit {
        lifecycle.onDestroy()
    }
}
Copy code
const val decompose = "2.0.0-compose-experimental-alpha-02"
const val essenty = "1.1.0"
@Arkadii Ivanov
a
Ok thanks! This looks related to https://kotlinlang.slack.com/archives/C03H3N51SKT/p1683725214780229?thread_ts=1683725214.780229&amp;cid=C03H3N51SKT , but at the same time a bit different. This looks like a general issue in the Cocoapods plugin, but it's not clear what is the cause and how to fix. A reproducer would be helpful. You can also try asking in #multiplatform
One of the options is to use "Regular Framework" integration instead of Cocoapods. Not sure if this is possible in your specific case, but here are some docs - https://kotlinlang.org/docs/multiplatform-mobile-understand-project-structure.html#ios-framework
s
@Arkadii Ivanov you told there , the solution that was to add more dependencies of Essentu like -> statekeeper, instanceKeeper, backHandler
a
Yes, but that's because there was another issue, and you have Lifecycle already which contains things you need.
s
i have to export this Lifecycle framework to swift project , not sure how can i do this with regular Framework
@Arkadii Ivanov i have invested much time in writing MVI, and decompose nav , now stuck at this issue
If you don't need to use any iOS frameworks in your Kotlin code, then most likely you can replace the Cocoapods integration with the regular framework, which is much more reliable.
s
cool , trying, thanks
a
But a reproducer would still be very useful I could share it with the JB team, there looks like a bug in the Cocoapods plugin.
s
sure if regular framework fix this issue iwill share
a
Thanks!
s
i have removed cocoapods and added this
Copy code
listOf(
        iosX64(), iosArm64(), iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "kmm"
            isStatic = true
//            freeCompilerArgs += "-Xbinary=bundleId=<http://io.rdash.app|io.rdash.app>"
            export(ArkIvanov.Decompose.decompose)
            export(ArkIvanov.Essenty.lifecycle)
        }
    }