Skip to content
Lucent
SEARCH LUCENT

Search guides, APIs, and examples.

GitHub

Very early and experimental. The language, the generated native code and every package API change without notice. Do not use Lucent in production.

Use a third-party SDK

Add the pod or Gradle dependency to the app as usual, then import it from lucent:ios/* or lucent:android/*.

linked.lucent.ts
import { PLATFORM } from "lucent:platform";
import { RCTAppDependencyProvider } from "lucent:ios/ReactAppDependencyProvider";
import { ContextCompat } from "lucent:android/androidx.core.content";
import { PackageManager } from "lucent:android/android.content.pm";
import { appContext } from "lucent:android";
export async function linkedLibraries(): Promise<string> {
if (PLATFORM === "ios") {
const provider = new RCTAppDependencyProvider();
return `${provider.urlRequestHandlerClassNames().length} request handlers, ${provider.imageDataDecoderClassNames().length} image decoders`;
} else {
const internet = ContextCompat.checkSelfPermission(appContext(), "android.permission.INTERNET");
return `INTERNET granted ${internet === PackageManager.PERMISSION_GRANTED}`;
}
}

A library the app already links is imported like the SDK: a pod's module on iOS, an AndroidX package on Android. This module is from the example apps, which add nothing for it.

  1. Add it to the app as usual: a pod in ios/Podfile, or a dependency in android/app/build.gradle.
  2. iOS: run pod install. Lucent reads the pods' headers from the app's Pods folder.
  3. Android: nothing more. lucent build asks Gradle for the app's compile classpath, and caches the answer until the Gradle files change.
  4. Import from lucent:ios/<Module> or lucent:android/<package>.
  • Swift Package Manager libraries can't be imported yet; CocoaPods ones can (roadmap).
  • A library in a Lucent package goes in its lucent.json instead, so apps get it when they install the package.