### Install Figma-Export for iOS Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/README.md After installing other dependencies, run this command in the `Example` directory to install the figma-export gem for iOS projects. ```bash bundle exec pod install ``` -------------------------------- ### Install CocoaPods and Fastlane for iOS Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/README.md Run this command in the `Example` directory to install necessary dependencies for iOS projects using Fastlane. ```bash bundle install ``` -------------------------------- ### Install figma-export via Homebrew Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Use this command to install the figma-export tool using Homebrew. Ensure you have Homebrew installed. ```bash brew install RedMadRobot/formulae/figma-export ``` -------------------------------- ### Install figma-export via Homebrew Source: https://context7.com/redmadrobot/figma-export/llms.txt Install the figma-export tool using Homebrew. Optionally, install `cwebp` for WebP image export. ```bash brew install RedMadRobot/formulae/figma-export # Optional: install cwebp for WebP image export brew install webp ``` -------------------------------- ### Install WebP support via Homebrew Source: https://github.com/redmadrobot/figma-export/blob/master/README.md If you need to export raster images in WebP format, install the 'webp' command line utility using Homebrew. ```bash brew install webp ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Ensure you have the latest version of the Xcode command line tools installed before proceeding with fastlane installation. ```bash xcode-select --install ``` -------------------------------- ### Install Fastlane using Homebrew Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Alternatively, fastlane can be installed using the Homebrew package manager. ```bash brew install fastlane ``` -------------------------------- ### SwiftUI Image Usage Example Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Example of how to use exported icons or images in SwiftUI views after they have been generated. ```swift VStack { Image.ic24Close Image.ic24DropdownDown } ``` -------------------------------- ### Run Figma Export Command Source: https://github.com/redmadrobot/figma-export/blob/master/CONFIG.md Example of running the figma-export command to export colors. The configuration is typically stored in a figma-export.yaml file. ```bash ./figma-export colors ``` -------------------------------- ### Install Fastlane using RubyGems Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Install fastlane using the RubyGems package manager. You may need to use sudo depending on your Ruby installation. ```bash [sudo] gem install fastlane -NV ``` -------------------------------- ### Jetpack Compose Icons Generation Source: https://context7.com/redmadrobot/figma-export/llms.txt Example of an auto-generated Kotlin file for Jetpack Compose icons. Ensure the `Icons.kt` template is used for generation. ```kotlin // Auto-generated: Icons.kt package com.redmadrobot.androidcomposeexample.ui.figmaexport import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource object Icons @Composable fun Icons.Ic24Close( contentDescription: String?, modifier: Modifier = Modifier, tint: Color = Color.Unspecified ) { Icon( painter = painterResource(id = R.drawable.ic_24_close), contentDescription = contentDescription, modifier = modifier, tint = tint ) } // Usage: Icons.Ic24Close(contentDescription = "Close") ``` -------------------------------- ### Export Colors from Figma (iOS) Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/README.md Execute this Fastlane command within the `Example` directory to export color resources from Figma for iOS projects. ```bash bundle exec fastlane export_colors ``` -------------------------------- ### Full iOS Configuration Example Source: https://context7.com/redmadrobot/figma-export/llms.txt Use this YAML configuration for comprehensive iOS export settings. It covers Figma file IDs, common asset naming and export rules, and detailed iOS-specific configurations for colors, icons, images, and typography. ```yaml figma: lightFileId: shPilWnVdJfo10YF12345 # Required: Figma file with light palette/icons/images darkFileId: KfF6DnJTWHGZzC912345 # Optional: Figma file with dark palette lightHighContrastFileId: ABC123 # Optional: high contrast light palette file darkHighContrastFileId: DEF456 # Optional: high contrast dark palette file timeout: 60 # Optional: API timeout in seconds (default: 30) common: colors: nameValidateRegexp: '^([a-zA-Z_]+)$' # Validate color names before export nameReplaceRegexp: 'color_$1' # Rename via capture group replacement useSingleFile: false # true = light+dark in Figma file darkModeSuffix: '_dark' # Suffix to identify dark colors (when useSingleFile: true) lightHCModeSuffix: '_lightHC' darkHCModeSuffix: '_darkHC' icons: figmaFrameName: Icons # Name of the Figma frame containing icons nameValidateRegexp: '^(ic)_(\d\d)_([a-z0-9_]+)$' useSingleFile: false darkModeSuffix: '_dark' images: figmaFrameName: Illustrations nameValidateRegexp: '^(img)_([a-z0-9_]+)$' useSingleFile: false darkModeSuffix: '_dark' typography: nameValidateRegexp: '^[a-zA-Z0-9_]+$' ios: xcodeprojPath: "./Example.xcodeproj" target: "UIComponents" xcassetsPath: "./Resources/Assets.xcassets" xcassetsInMainBundle: true xcassetsInSwiftPackage: false # true for Swift Package targets resourceBundleNames: [] # Bundle names for SwiftUI Preview support addObjcAttribute: false # true to add @objc for Objective-C access templatesPath: "./Resources/Templates" # Custom Stencil templates directory colors: useColorAssets: true # true = .xcassets + extension; false = extension only assetsFolder: Colors # Subfolder inside Assets.xcassets nameStyle: camelCase # camelCase or snake_case colorSwift: "./Sources/UIColor+extension.swift" swiftuiColorSwift: "./Source/Color+extension.swift" groupUsingNamespace: true # "/" in name → grouped namespace folders icons: format: pdf # pdf or svg assetsFolder: Icons nameStyle: camelCase preservesVectorRepresentation: - ic24TabBarMain imageSwift: "./Sources/UIImage+extension_icons.swift" swiftUIImageSwift: "./Source/Image+extension_icons.swift" renderMode: template # template, original, or default images: assetsFolder: Illustrations nameStyle: camelCase scales: [1, 2, 3] imageSwift: "./Sources/UIImage+extension_illustrations.swift" swiftUIImageSwift: "./Source/Image+extension_illustrations.swift" typography: fontSwift: "./Source/UIFont+extension.swift" labelStyleSwift: "./Source/LabelStyle+extension.swift" swiftUIFontSwift: "./Source/Font+extension.swift" generateLabels: true # Generates HeaderLabel, BodyLabel, etc. labelsDirectory: "./Source/UIComponents/" nameStyle: camelCase ``` -------------------------------- ### Full Android Configuration Example Source: https://context7.com/redmadrobot/figma-export/llms.txt This YAML configuration is for Android export settings. It includes Figma file IDs, common asset configurations, and Android-specific settings for colors, icons, images, and typography, including Jetpack Compose integration. ```yaml figma: lightFileId: G85iqgmYDrE5WrjDmiAZ6G darkFileId: 3xUDq03vQwF1tAFBK6A9Tf common: icons: figmaFrameName: Icons images: figmaFrameName: Illustrations android: mainRes: ./app/src/main/res # Path to main/res directory resourcePackage: "com.example.app" # Required for Jetpack Compose code generation mainSrc: "./app/src/main/java" # Required for Jetpack Compose code generation templatesPath: "./Resources/Templates" colors: composePackageName: "com.example.app.ui.figmaexport" # Generates Colors.kt icons: output: "figma-export-icons" # Subdirectory under mainRes; cleared on each run composePackageName: "com.example.app.ui.figmaexport" # Generates Icons.kt images: output: "figma-export-images" # Subdirectory under mainRes; cleared on each run format: webp # svg, png, or webp scales: [1, 1.5, 2, 3, 4] # mdpi / hdpi / xhdpi / xxhdpi / xxxhdpi webpOptions: encoding: lossy # lossy or lossless quality: 85 # 0-100, lossy only typography: nameStyle: camelCase composePackageName: "com.example.app.ui.figmaexport" # Generates Typography.kt ``` -------------------------------- ### Export Typography from Figma (iOS) Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/README.md Execute this Fastlane command within the `Example` directory to export typography resources from Figma for iOS projects. ```bash bundle exec fastlane export_typography ``` -------------------------------- ### Jetpack Compose Typography Generation Source: https://context7.com/redmadrobot/figma-export/llms.txt Example of an auto-generated Kotlin file for Jetpack Compose typography. This file defines text styles like 'body' and 'header'. ```kotlin // Auto-generated: Typography.kt package com.redmadrobot.androidcomposeexample.ui.figmaexport import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.sp object Typography { val body = TextStyle( fontFamily = FontFamily(Font(R.font.ptsans_regular)), fontSize = 16.0.sp, letterSpacing = 0.0.sp, lineHeight = 24.0.sp, ) val header = TextStyle( fontFamily = FontFamily(Font(R.font.ptsans_bold)), fontSize = 20.0.sp, letterSpacing = 0.0.sp, lineHeight = 28.0.sp, ) } ``` -------------------------------- ### Android Project Setup for FigmaExport Source: https://context7.com/redmadrobot/figma-export/llms.txt Gradle configuration to register FigmaExport output directories in the Android project's source sets. This ensures generated assets are recognized by the build system. ```groovy android { sourceSets { main { res.srcDirs += "src/main/res/figma-export-icons" res.srcDirs += "src/main/res/figma-export-images" } } } ``` -------------------------------- ### Custom Stencil Template for SwiftUI Color Extension Source: https://context7.com/redmadrobot/figma-export/llms.txt Example Stencil template for generating a SwiftUI Color extension. This template iterates through colors defined in Figma and generates corresponding static Color properties. ```stencil {# Example custom Color+extension.swift.stencil #} import SwiftUI public extension Color { {% for color in colors %} /// {{ color.originalName }} static var {{ color.name }}: Color { {% if colorFromAssetCatalog %} return Color("{{ color.originalName }}") {% else %} return Color(red: {{ color.red }}, green: {{ color.green }}, blue: {{ color.blue }}, opacity: {{ color.alpha }}) {% endif %} } {% endfor %} } ``` -------------------------------- ### Set Figma Personal Access Token Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Before installation or usage, set your Figma personal access token as an environment variable. This token is required to access the Figma API. ```bash export FIGMA_PERSONAL_TOKEN=value ``` -------------------------------- ### iOS SwiftUI Image Extension for Icons Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Swift extension for `Image` for use in SwiftUI views. Provides easy access to icon assets. Includes a usage example. ```swift // Auto-generated: Image+extension_icons.swift import SwiftUI extension Image { static var ic16Notification: Image { return Image(#function) } static var ic24Close: Image { return Image(#function) } static var ic24DropdownDown: Image { return Image(#function) } } // Usage in SwiftUI views: VStack { Image.ic24Close Image.ic24DropdownDown } ``` -------------------------------- ### iOS UIKit Color Extension with Dark Mode Support Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Swift extension for `UIColor` that supports dark mode using `traitCollection`. This example assumes `useColorAssets` is `false`. ```swift // Auto-generated: UIColor+extension.swift import UIKit extension UIColor { static var primaryText: UIColor { if #available(iOS 13.0, *) { return UIColor { traitCollection -> UIColor in if traitCollection.userInterfaceStyle == .dark { return UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 1.000) } else { return UIColor(red: 1.000, green: 1.000, blue: 1.000, alpha: 1.000) } } } else { return UIColor(red: 1.000, green: 1.000, blue: 1.000, alpha: 1.000) } } } ``` -------------------------------- ### Initialize FigmaExport Configuration Source: https://context7.com/redmadrobot/figma-export/llms.txt Scaffolds a starter configuration file for the specified platform. Use this to set up your project's export settings. ```bash figma-export init --platform ios ``` ```bash figma-export init --platform android ``` -------------------------------- ### Initialize Figma Export Config Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generate a default figma-export.yaml configuration file for Android or iOS. ```bash figma-export init --platform android ``` ```bash figma-export init --platform ios ``` -------------------------------- ### Configure Figma Color Variables Source: https://context7.com/redmadrobot/figma-export/llms.txt Set up `common.variablesColors` to use Figma Variables (Beta API) for color definitions. Ensure `common.colors` is not used simultaneously. Requires `figma.lightFileId` for icons and images. ```yaml figma: lightFileId: shPilWnVdJfo10YF12345 common: variablesColors: tokensFileId: shPilWnVdJfo10YF12345 tokensCollectionName: "Base collection" lightModeName: "Light" darkModeName: "Dark" lightHCModeName: "Contrast Light" darkHCModeName: "Contrast Dark" primitivesModeName: "Collection_1" nameValidateRegexp: '^([a-zA-Z_]+)$' nameReplaceRegexp: 'color_$1' ``` -------------------------------- ### Configure Android Build Gradle Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Add these lines to your app's build.gradle file to include FigmaExport directories for assets. ```gradle android { ... sourceSets { main { res.srcDirs += "src/main/res/figma-export-icons" res.srcDirs += "src/main/res/figma-export-images" } } } ``` -------------------------------- ### Export Specific Icons by Name Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Use command-line arguments to export specific icons by their names or patterns. Wildcards are supported for multiple icons. ```bash ./figma-export icons "ic/24/edit" ``` ```bash ./figma-export icons "ic/24/edit, ic/16/notification" ``` ```bash ./figma-export icons "ic/24/videoplayer/*" ``` -------------------------------- ### Fastlane integration for figma-export Source: https://context7.com/redmadrobot/figma-export/llms.txt Configure Fastlane lanes to automate the synchronization of colors and icons from Figma. Ensure the correct path to the figma-export binary is used. ```ruby # Fastfile lane :sync_colors do Dir.chdir("../") do sh "Pods/FigmaExport/Release/figma-export colors ." end end lane :sync_icons do Dir.chdir("../") do sh "Pods/FigmaExport/Release/figma-export icons ." end end ``` ```bash # Run via Fastlane fastlane sync_colors fastlane sync_icons ``` -------------------------------- ### Export Colors with Wildcard Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Export colors that match a specified pattern. Note: Wildcards may not work on Linux. ```bash ./figma-export colors "common/*" ``` -------------------------------- ### Configure Fastlane for FigmaExport Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Add this lane to your Fastfile to automate the synchronization of colors using figma-export. Ensure the figma-export.yaml file is in the project root. ```ruby lane :sync_colors do Dir.chdir("../") do sh "Pods/FigmaExport/Release/figma-export colors ." end end ``` -------------------------------- ### Export Typography Styles with FigmaExport Source: https://context7.com/redmadrobot/figma-export/llms.txt Fetches Figma Text Styles and generates platform-specific typography files for Swift (UIFont, SwiftUI Font) and Android (XML, Jetpack Compose). Use the -i flag to specify the configuration file path. ```bash figma-export typography -i figma-export.yaml ``` -------------------------------- ### SwiftUI Color Extension with Custom Values Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for SwiftUI when `useColorAssets: False` is set in the configuration. Provides direct Color initializations with RGBA values. ```swift import SwiftUI public extension ShapeStyle where Self == Color { static var primaryText: Color { Color(red: 1.000, green: 1.000, blue: 1.000, opacity: 1.000) } } ``` -------------------------------- ### Export Colors from Figma Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Run this fastlane action to export colors defined in your Figma project. ```bash fastlane export_colors ``` -------------------------------- ### Export Icons from Figma Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Run this fastlane action to export icons defined in your Figma project. ```bash fastlane export_icons ``` -------------------------------- ### Export Colors using Figma CLI Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Use this command in the terminal to export colors from Figma. Ensure you are in the directory with the figma-export binary and have a figma-export.yaml file. ```bash ./figma-export colors -i figma-export.yaml ``` -------------------------------- ### Export Images from Figma Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Run this fastlane action to export images defined in your Figma project. ```bash fastlane export_images ``` -------------------------------- ### UIKit Color Extension with Custom Values Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for UIKit when `useColorAssets: False` is set in the configuration. Provides direct UIColor initializations with RGBA values, including support for dark mode. ```swift import UIKit extension UIColor { static var primaryText: UIColor { if #available(iOS 13.0, *) { return UIColor { traitCollection -> UIColor in if traitCollection.userInterfaceStyle == .dark { return UIColor(red: 0.000, green: 0.000, blue: 0.000, alpha: 1.000) } else { return UIColor(red: 1.000, green: 1.000, blue: 1.000, alpha: 1.000) } } } else { return UIColor(red: 1.000, green: 1.000, blue: 1.000, alpha: 1.000) } } static var backgroundVideo: UIColor { return UIColor(red: 0.467, green: 0.012, blue: 1.000, alpha: 0.500) } } ``` -------------------------------- ### Export Color Palettes with FigmaExport Source: https://context7.com/redmadrobot/figma-export/llms.txt Fetches color styles or variables from Figma and writes them to platform-native files. Ensure your FIGMA_PERSONAL_TOKEN is set for authentication. Supports exporting all colors, specific colors by name, or all colors within a folder. ```bash export FIGMA_PERSONAL_TOKEN=your_personal_access_token figma-export colors ``` ```bash figma-export colors -i ./configs/figma-export.yaml ``` ```bash figma-export colors "background/default" ``` ```bash figma-export colors "background/default, background/secondary" ``` ```bash figma-export colors "background/*" ``` -------------------------------- ### Export Icons using Figma CLI Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Use this command in the terminal to export icons from Figma. Ensure you are in the directory with the figma-export binary and have a figma-export.yaml file. ```bash ./figma-export icons -i figma-export.yaml ``` -------------------------------- ### Export Images using Figma CLI Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Use this command in the terminal to export images from Figma. Ensure you are in the directory with the figma-export binary and have a figma-export.yaml file. ```bash ./figma-export images -i figma-export.yaml ``` -------------------------------- ### Export Colors from Figma (Android) Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/README.md Run this command in your Android project to export color resources from Figma. ```bash figma-export colors ``` -------------------------------- ### Export Typography from Figma (Android) Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/README.md Run this command in your Android project to export typography resources from Figma. ```bash figma-export typography ``` -------------------------------- ### Android colors.xml for Light and Dark Modes Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated XML resource files for Android colors, including separate files for light (`values/colors.xml`) and dark (`values-night/colors.xml`) themes. ```xml #FFFFFF #F5F5F5 #000000 #121212 #1E1E1E #FFFFFF ``` -------------------------------- ### Export Typography using Figma CLI Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Use this command in the terminal to export typography from Figma. Ensure you are in the directory with the figma-export binary and have a figma-export.yaml file. ```bash ./figma-export typography -i figma-export.yaml ``` -------------------------------- ### Export Typography from Figma Source: https://github.com/redmadrobot/figma-export/blob/master/Examples/ExampleSwiftUI/fastlane/README.md Run this fastlane action to export typography styles defined in your Figma project. ```bash fastlane export_typography ``` -------------------------------- ### Export Image Assets with FigmaExport Source: https://context7.com/redmadrobot/figma-export/llms.txt Downloads illustration components from Figma and writes them to Xcode or Android drawable directories. Supports exporting all images, a single image by name, or a group of images. ```bash figma-export images -i figma-export.yaml ``` ```bash figma-export images "img/login" ``` ```bash figma-export images "img/onboarding/*" ``` -------------------------------- ### iOS UIKit Color Extension (useColorAssets: true) Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Swift extension for `UIColor` when `useColorAssets` is set to `true`. Colors are referenced by function name. ```swift // Auto-generated: UIColor+extension.swift import UIKit extension UIColor { static var backgroundPrimary: UIColor { return UIColor(named: #function)! } static var backgroundSecondary: UIColor { return UIColor(named: #function)! } static var textPrimary: UIColor { return UIColor(named: #function)! } } ``` -------------------------------- ### Generate Android Typography with Jetpack Compose Source: https://github.com/redmadrobot/figma-export/blob/master/README.md This code snippet illustrates generating Android typography for Jetpack Compose. It assumes typography is exported to values/typography.xml. ```kotlin package com.redmadrobot.androidcomposeexample.ui.figmaexport import ... object Typography { val body = TextStyle( fontFamily = FontFamily(Font(R.font.ptsans_regular)), fontSize = 16.0.sp, letterSpacing = 0.0.sp, lineHeight = 24.0.sp, ) } ``` -------------------------------- ### iOS UIImage Extension for Icons Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Swift extension for `UIImage` to easily access icon assets by their names. ```swift // Auto-generated: UIImage+extension_icons.swift import UIKit extension UIImage { static var ic16Notification: UIImage { return UIImage(named: #function)! } static var ic24ArrowRight: UIImage { return UIImage(named: #function)! } static var ic24Close: UIImage { return UIImage(named: #function)! } } ``` -------------------------------- ### Figma Export Configuration (YAML) Source: https://github.com/redmadrobot/figma-export/blob/master/CONFIG.md Defines the structure of the figma-export.yaml configuration file. Specify Figma file IDs for light, dark, and high contrast themes, and set API timeouts. ```yaml --- figma: # [required] Identifier of the file containing light color palette, icons and light images. To obtain a file id, open the file in the browser. The file id will be present in the URL after the word file and before the file name. lightFileId: shPilWnVdJfo10YF12345 # [optional] Identifier of the file containing dark color palette and dark images. darkFileId: KfF6DnJTWHGZzC912345 # [optional] Identifier of the file containing light high contrast color palette. lightHighContrastFileId: KfF6DnJTWHGZzC912345 # [optional] Identifier of the file containing dark high contrast color palette. darkHighContrastFileId: KfF6DnJTWHGZzC912345 # [optional] Figma API request timeout. The default value of this property is 30 (seconds). If you have a lot of resources to export set this value to 60 or more to give Figma API more time to prepare resources for exporting. # timeout: 30 ``` -------------------------------- ### UIKit UIImage Extension for Figma Images Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for UIKit to access exported images using their names. Assumes images are exported to Assets.xcassets. ```swift import UIKit extension UIImage { static var illZeroEmpty: UIImage { return UIImage(named: #function)! } static var illZeroNetworkError: UIImage { return UIImage(named: #function)! } static var illZeroServerError: UIImage { return UIImage(named: #function)! } ... } ``` -------------------------------- ### Add figma-export as a CocoaPod Source: https://context7.com/redmadrobot/figma-export/llms.txt Integrate the figma-export library into your iOS project by adding it to your Podfile. ```ruby # Podfile pod 'FigmaExport' ``` -------------------------------- ### SwiftUI Image Extension for Figma Export Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for SwiftUI to access exported icons or images using their names. Assumes assets are exported to Assets.xcassets. ```swift import SwiftUI extension Image { static var ic16Notification: Image { return Image(#function) } static var ic24Close: Image { return Image(#function) } static var ic24DropdownDown: Image { return Image(#function) } static var ic24DropdownUp: Image { return Image(#function) } ... } ``` -------------------------------- ### UIKit Color Extension for Figma Export Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for UIKit to access exported colors using their names. Assumes colors are exported to Assets.xcassets. ```swift import UIKit extension UIColor { static var backgroundSecondaryError: UIColor { return UIColor(named: #function)! } static var backgroundSecondarySuccess: UIColor { return UIColor(named: #function)! } static var backgroundVideo: UIColor { return UIColor(named: #function)! } ... } ``` -------------------------------- ### SwiftUI Color Extension for Figma Export Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for SwiftUI to access exported colors using their names. Assumes colors are exported to Assets.xcassets. ```swift import SwiftUI extension Color { static var backgroundSecondaryError: Color { return Color(#function) } static var backgroundSecondarySuccess: Color { return Color(#function) } static var backgroundVideo: Color { return Color(#function) } ... } ``` -------------------------------- ### Generate Android Icons with Jetpack Compose Source: https://github.com/redmadrobot/figma-export/blob/master/README.md This code snippet demonstrates generating Android icons for Jetpack Compose. It assumes icons are exported to the drawable directory. ```kotlin package com.redmadrobot.androidcomposeexample.ui.figmaexport import ... object Icons @Composable fun Icons.Ic24DropdownDown( contentDescription: String?, modifier: Modifier = Modifier, tint: Color = Color.Unspecified ) { Icon( painter = painterResource(id = R.drawable.ic_24_dropdown_down), contentDescription = contentDescription, modifier = modifier, tint = tint ) } ``` -------------------------------- ### Android Typography Export Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Place font files in the `res` directory and run the `figma-export typography` command. A top-level style in XML is required to parent the generated styles. ```xml ``` -------------------------------- ### Export Icon Assets with FigmaExport Source: https://context7.com/redmadrobot/figma-export/llms.txt Downloads icon components from Figma, converts them to appropriate formats, and saves them for Xcode or Android projects. You can export all icons, a single icon by name, or a group of icons. ```bash figma-export icons -i figma-export.yaml ``` ```bash figma-export icons "ic/24/edit" ``` ```bash figma-export icons "ic/24/edit, ic/16/notification" ``` ```bash figma-export icons "ic/16/*" ``` -------------------------------- ### Add FigmaExport to Podfile Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Include this line in your Podfile to add the FigmaExport dependency for CocoaPods. This allows invoking the tool via Pods/FigmaExport/Release/figma-export. ```ruby pod 'FigmaExport' ``` -------------------------------- ### UIKit UIImage Extension for Figma Export Source: https://github.com/redmadrobot/figma-export/blob/master/README.md Generated Swift file for UIKit to access exported icons or images using their names. Assumes assets are exported to Assets.xcassets. ```swift import UIKit extension UIImage { static var ic16Notification: UIImage { return UIImage(named: #function)! } static var ic24ArrowRight: UIImage { return UIImage(named: #function)! } static var ic24Close: UIImage { return UIImage(named: #function)! } static var ic24Dots: UIImage { return UIImage(named: #function)! } ... } ``` -------------------------------- ### Generate Android Colors with Jetpack Compose Source: https://github.com/redmadrobot/figma-export/blob/master/README.md This code snippet shows how to generate Android colors for Jetpack Compose. It assumes colors are configured and exported. ```kotlin package com.redmadrobot.androidcomposeexample.ui.figmaexport import ... object Colors @Composable @ReadOnlyComposable fun Colors.backgroundPrimary(): Color = colorResource(id = R.color.background_primary) ``` -------------------------------- ### iOS SwiftUI Color Extension Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Swift extension for `Color` for use in SwiftUI views. Colors are referenced by function name. ```swift // Auto-generated: Color+extension.swift import SwiftUI extension Color { static var backgroundPrimary: Color { return Color(#function) } static var backgroundSecondary: Color { return Color(#function) } static var textPrimary: Color { return Color(#function) } } ``` -------------------------------- ### Android Jetpack Compose Colors Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Kotlin code for Jetpack Compose, providing composable functions to access color resources defined in `colors.xml`. ```kotlin // Auto-generated: Colors.kt package com.redmadrobot.androidcomposeexample.ui.figmaexport import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.ui.res.colorResource import androidx.compose.ui.graphics.Color object Colors @Composable @ReadOnlyComposable fun Colors.backgroundPrimary(): Color = colorResource(id = R.color.background_primary) ``` -------------------------------- ### iOS UIFont Extension Source: https://context7.com/redmadrobot/figma-export/llms.txt Generated Swift extension for `UIFont` to access custom font styles. Includes placeholder implementations for header, body, and caption fonts. ```swift // Auto-generated: UIFont+extension.swift import UIKit extension UIFont { static func header() -> UIFont { ... } // Usage: UIFont.header() static func body() -> UIFont { ... } static func caption1() -> UIFont { ... } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.