Skip to content

Add Figma Code Connect generation for Android (Jetpack Compose) - #58

Merged
alexey1312 merged 2 commits into
mainfrom
alexey1312/add-android-code-connect
Feb 17, 2026
Merged

Add Figma Code Connect generation for Android (Jetpack Compose)#58
alexey1312 merged 2 commits into
mainfrom
alexey1312/add-android-code-connect

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

Description

Add Figma Code Connect support for Android, mirroring the existing iOS integration. When configured, ExFig now generates .figma.kt files with @FigmaConnect annotations that link Figma design components to Jetpack Compose implementations, enabling designers to view corresponding Compose code directly in Figma Dev Mode.

  • Add AndroidCodeConnectExporter in AndroidExport module with Stencil-based Kotlin generation
  • Add codeConnectKotlin field to Android.IconsEntry and Android.ImagesEntry PKL schemas
  • Wire Code Connect generation into all icon (VectorDrawable + ImageVector) and image (5 format pipelines) export paths
  • Add CodeConnect.figma.kt.stencil template for @FigmaConnect annotated Composable functions
  • Add 7 unit tests covering asset filtering, node ID conversion, sort order, and granular cache mode
  • Update CONFIG.md and README.md documentation

Test Plan

  • AndroidCodeConnectExporterTests — 7 tests pass (asset generation, nil handling, mixed assets, nodeId colon→hyphen, sort order, granular cache, file destination)
  • EnumBridgingTests — 45 tests pass (PKL type bridging with new codeConnectKotlin parameter)
  • ExFig_AndroidTests — 32 tests pass (integration)
  • Full build passes
  • SwiftLint clean
  • SwiftFormat clean

🤖 Generated with Claude Code

Introduce functionality to generate Figma Code Connect Kotlin files for
Jetpack Compose. The `AndroidCodeConnectExporter` class and related
methods allow linking Figma design components to Compose code, creating
an important connection for designers to view Compose implementations in
Figma Dev Mode.

- Added `AndroidCodeConnectExporter` with a method to generate Kotlin
  files from image packs.
- Expanded `AndroidIconsEntry` and `AndroidImagesEntry` to include a
  `codeConnectKotlin` field for file path configuration.
- Updated configuration schemas and generator logic for Code Connect
  inclusion.
- Integrated Code Connect generation into icon and image export
  workflows within the `AndroidIconsExporter` and `AndroidImagesExporter`
  classes.
- Created tests for `AndroidCodeConnectExporter` to ensure expected
  behavior, including asset filtering, URL generation, and file output.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @alexey1312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Android development workflow by integrating Figma Code Connect. It bridges the gap between design and development by automating the generation of Kotlin files that link Figma components to their Jetpack Compose implementations. This feature aims to improve collaboration and streamline the handoff process for Android projects, ensuring that design specifications are accurately reflected in the codebase.

Highlights

  • Figma Code Connect for Android: Introduced support for Figma Code Connect in Android (Jetpack Compose), allowing ExFig to generate .figma.kt files with @FigmaConnect annotations. This enables designers to view corresponding Compose code directly within Figma Dev Mode, mirroring the existing iOS integration.
  • New Exporter and Template: Added AndroidCodeConnectExporter to handle Kotlin generation for Code Connect and a new Stencil template (CodeConnect.figma.kt.stencil) for @FigmaConnect annotated Composable functions.
  • Configuration and Integration: Integrated Code Connect generation into all icon (VectorDrawable + ImageVector) and image (5 format pipelines) export paths. New codeConnectKotlin fields were added to Android.IconsEntry and Android.ImagesEntry PKL schemas for configuration.
  • Documentation and Testing: Updated CONFIG.md and README.md to reflect the new functionality. Seven new unit tests were added for AndroidCodeConnectExporter covering various scenarios, and existing tests were updated to accommodate the new parameters.
Changelog
  • CONFIG.md
    • Added codeConnectKotlin field to Android.IconsEntry and Android.ImagesEntry documentation.
  • README.md
    • Updated platform support to include Figma Code Connect integration for Android.
  • Sources/AndroidExport/AndroidCodeConnectExporter.swift
    • Added AndroidCodeConnectExporter class for generating Figma Code Connect Kotlin files.
  • Sources/AndroidExport/CLAUDE.md
    • Updated documentation to include AndroidCodeConnectExporter and its *.figma.kt output.
    • Updated class hierarchy to include AndroidCodeConnectExporter.
    • Updated template system to list the new CodeConnect.figma.kt.stencil template.
  • Sources/AndroidExport/Resources/CodeConnect.figma.kt.stencil
    • Added new Stencil template for generating Figma Code Connect Kotlin files.
  • Sources/ExFig-Android/CLAUDE.md
    • Updated documentation to mention optional Figma Code Connect generation for icons and images.
  • Sources/ExFig-Android/Config/AndroidIconsEntry.swift
    • Added codeConnectKotlinURL computed property to Android.IconsEntry.
  • Sources/ExFig-Android/Config/AndroidImagesEntry.swift
    • Added codeConnectKotlinURL computed property to Android.ImagesEntry.
  • Sources/ExFig-Android/Export/AndroidIconsExporter.swift
    • Integrated generateCodeConnect logic to export Code Connect files for icons.
    • Added generateCodeConnect helper function to create Code Connect files.
  • Sources/ExFig-Android/Export/AndroidImagesExporter.swift
    • Integrated generateCodeConnect logic into various image export pipelines.
    • Added generateCodeConnect helper function to create Code Connect files for images.
  • Sources/ExFigCLI/Resources/Schemas/Android.pkl
    • Added codeConnectKotlin field to IconsEntry and ImagesEntry schemas.
  • Sources/ExFigCLI/Resources/androidConfig.swift
    • Added commented-out examples for codeConnectKotlin in IconsEntry and ImagesEntry.
  • Sources/ExFigConfig/Generated/Android.pkl.swift
    • Added codeConnectKotlin property to IconsEntry and ImagesEntry structs.
    • Reordered and refactored AndroidConfig, Module, NameTransform, and ThemeAttributes structs.
  • Sources/ExFigConfig/Generated/Common.pkl.swift
    • Reordered Common_NameProcessing protocol and WebpEncoding enum within Common extension.
  • Tests/AndroidExportTests/AndroidCodeConnectExporterTests.swift
    • Added new test file AndroidCodeConnectExporterTests with 7 unit tests for Code Connect generation.
  • Tests/ExFigTests/Input/EnumBridgingTests.swift
    • Updated Android.IconsEntry and Android.ImagesEntry initializers in test cases to include codeConnectKotlin parameter.
Activity
  • The author, alexey1312, has implemented the core functionality for Figma Code Connect generation for Android.
  • The pull request includes comprehensive unit tests for the new AndroidCodeConnectExporter.
  • Existing test suites (EnumBridgingTests, ExFig_AndroidTests) have been run and passed, indicating no regressions.
  • The code has been checked for SwiftLint and SwiftFormat compliance.
  • Documentation in CONFIG.md and README.md has been updated to reflect the new feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds Figma Code Connect support for Android, which is a great feature to bring parity with the existing iOS integration. The changes are well-structured, including the new AndroidCodeConnectExporter, schema updates, integration into the export pipelines, and new tests. I've identified a few areas for improvement regarding code duplication, API consistency between icons and images, and error handling that would make this feature even more robust and maintainable. Additionally, a small update to the generated Kotlin template would align it better with modern Android development practices.

Comment thread Sources/ExFig-Android/Export/AndroidImagesExporter.swift
Comment thread Sources/ExFig-Android/Export/AndroidImagesExporter.swift Outdated
Comment thread Sources/ExFig-Android/Export/AndroidIconsExporter.swift Outdated
Comment thread Sources/AndroidExport/Resources/CodeConnect.figma.kt.stencil Outdated
@alexey1312
alexey1312 merged commit 9a45993 into main Feb 17, 2026
3 checks passed
@alexey1312
alexey1312 deleted the alexey1312/add-android-code-connect branch February 17, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant