Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including a public ProvidableCompositionLocal causes linking for iOS targets to fail #2903

Closed
xxfast opened this issue Mar 21, 2023 · 3 comments
Assignees
Labels
bug Something isn't working compiler Compiler plugin related

Comments

@xxfast
Copy link

xxfast commented Mar 21, 2023

Describe the bug
I have a ProvidableCompositionLocal defined as

val LocalUnit: ProvidableCompositionLocal<Unit> = staticCompositionLocalOf { }

This causes linking to fail

> Task :app:ios-compose:linkPodDebugFrameworkIosSimulatorArm64
Unbound public symbol IrSimpleFunctionPublicSymbolImpl: androidx.compose.runtime/CompositionLocal.current.<get-current>|-5302841245303420610[0]

Current workaround is to mark these either private or internal

private val LocalUnit: ProvidableCompositionLocal<Unit> = staticCompositionLocalOf { }
// or
internal val LocalUnit: ProvidableCompositionLocal<Unit> = staticCompositionLocalOf { }

Affected platforms
Select one of the platforms below:

  • iOS

Versions

  • Kotlin version*: 1.8.10
  • Compose Multiplatform version*: 1.3.1
  • OS version(s)*: iOS 16.2
  • OS architecture (x86 or arm64): arm64

To Reproduce
Steps and/or the code snippet to reproduce the behavior:

  1. Checkout xxfast/NYTimes-KMP@add79ab
  2. Open app/ios/ios.xcworkspace from xcode and run

Expected behavior
iOS targets to support ProvidableCompositionLocal similar to android and desktop targets

@eymar
Copy link
Member

eymar commented Mar 23, 2023

Another workaround is to add an annotation:

@HiddenFromObjC
val LocalUnit: ProvidableCompositionLocal<Unit> = staticCompositionLocalOf { }

It can be added to properties and functions (you may try it for other issues you reported).

Our goal is to fix it so there won't be a need to use internal or the @HiddenFromObjC annotation.

@eymar
Copy link
Member

eymar commented Apr 12, 2023

The fix is available with Compose Multiplatform 1.4.0 when used with kotlin 1.8.20

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working compiler Compiler plugin related
Projects
None yet
Development

No branches or pull requests

3 participants