Closed VadimYakovliev closed 3 years ago
I will check it asap.
I've installed Xcode 12.3 and figma-export via Homebrew. Next, I execute figma-export icons
for iOS Example project. figma-export finished exporting without any issues.
Could you please give me access to your Figma file and share figma-export.yaml
file?
The illegal hardware instruction
error says that figma-export crashes on force unwrap. It means that your config file or Figma file contains errors. I need to see your files to find an error.
Possible errors: invalid regexp for icon name, Invalid icon name
Thanks for you answers)
If process has invalid regexp for icon name or invalid icon name, the log of these errors was displayed in the console. Example (before version figma-export 0.18.5):
Error: Bad asset name «Secondary _ 006»
Bad asset name «Secondary _ 005»
Bad asset name «Primary _ 003»
Bad asset name «Secondary _ 001»
Bad asset name «Secondary _ 002»
I certainly have a suspicion that the designers broke something. I'm in the process of finding out))
My config file, but I replaced the project id in figma:
---
figma:
# 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: KfF6DnJTWHGZzC912345
# [optional] Common export parameters
common:
colors:
figmaFrameName: Colors
# RegExp pattern for color name validation before exporting
nameValidateRegexp: '^(\w+) _ (\d+)$' # RegExp pattern for: background, background_primary, widget_primary_background
icons:
# Name of the Figma's frame where icons components are located
figmaFrameName: Icons
# RegExp pattern for icon name validation before exporting
nameValidateRegexp: '^(\w+) _ (\d+)px _ (\w+)$' # RegExp pattern for: ic_24_icon_name, ic_24_icon
images:
# Name of the Figma's frame where image components are located
figmaFrameName: Illustrations
# RegExp pattern for image name validation before exporting
nameValidateRegexp: '^(\w+)$' # RegExp pattern for: img_image_name
# [optional] iOS export parameters
ios:
# Path to xcodeproj
xcodeprojPath: "./scanner3.xcodeproj"
# Xcode Target containing resources and corresponding swift code
target: "UIComponents"
# Absolute or relative path to the Assets.xcassets directory
xcassetsPath: "./UIComponents/Resources/Assets.xcassets"
# Is Assets.xcassets located in the main bundle?
xcassetsInMainBundle: false
# Parameters for exporting colors
colors:
# How to export colors? Use .xcassets and UIColor extension (useColorAssets = true) or extension only (useColorAssets = false)
useColorAssets: True
# [required if useColorAssets: True] Name of the folder inside Assets.xcassets where to place colors (.colorset directories)
assetsFolder: Colors
# Color name style: camelCase or snake_case
nameStyle: camelCase
# [optional] Absolute or relative path to swift file where to export UIKit colors (UIColor) for accessing from the code (e.g. UIColor.backgroundPrimary)
colorSwift: "./UIComponents/Source/UIColor+extension.swift"
# [optional] Absolute or relative path to swift file where to export SwiftUI colors (Color) for accessing from the code (e.g. Color.backgroundPrimary)
#swiftuiColorSwift: "./Source/Color+extension.swift"
# Parameters for exporting icons
icons:
# Image file format: pdf or svg
format: pdf
# Name of the folder inside Assets.xcassets where to place icons (.imageset directories)
assetsFolder: Icons
# Icon name style: camelCase or snake_case
nameStyle: camelCase
# [optional] An array of icon names that will supports Preseve Vecotor Data
#preservesVectorRepresentation:
#- ic24TabBarMain
#- ic24TabBarEvents
#- ic24TabBarProfile
# [optional] Absolute or relative path to swift file where to export icons (SwiftUI’s Image) for accessing from the code (e.g. Image.illZeroNoInternet)
#swiftUIImageSwift: "./Source/Image+extension_icons.swift"
# [optional] Absolute or relative path to swift file where to generate extension for UIImage for accessing icons from the code (e.g. UIImage.ic24ArrowRight)
imageSwift: "./UIComponents/Source/UIImage+extension_icons.swift"
# Parameters for exporting images
images:
# Name of the folder inside Assets.xcassets where to place images (.imageset directories)
assetsFolder: Illustrations
# Image name style: camelCase or snake_case
nameStyle: camelCase
# [optional] Absolute or relative path to swift file where to export images (SwiftUI’s Image) for accessing from the code (e.g. Image.illZeroNoInternet)
#swiftUIImageSwift: "./Source/Image+extension_illustrations.swift"
# [optional] Absolute or relative path to swift file where to generate extension for UIImage for accessing illustrations from the code (e.g. UIImage.illZeroNoInternet)
imageSwift: "./UIComponents/Source/UIImage+extension_illustrations.swift"
# Parameters for exporting typography
typography:
# [optional] Absolute or relative path to swift file where to export UIKit fonts (UIFont extension).
fontSwift: "./UIComponents/Source/UIFont+extension.swift"
# [optional] Absolute or relative path to swift file where to export SwiftUI fonts (Font extension).
# swiftUIFontSwift: "./Source/View/Common/Font+extension.swift"
# Should FigmaExport generate UILabel for each text style (font)? E.g. HeaderLabel, BodyLabel, CaptionLabel
generateLabels: false
# Relative or absolute path to directory where to place UILabel for each text style (font) (Requred if generateLabels = true)
# labelsDirectory: "./Source/UIComponents/"
Icon name must not contains whitespaces.
Secondary _ 005
❌
Secondary_005
✅
Could you please remove whitespaces and check it again?
You didn't understand me at all)) I meant that the errors you mentioned (Possible errors: invalid regexp for icon name, Invalid icon name) have always been logged before
Is it possible to give me permission to see you Figma file? This is the fastest way to fix your issue.
We found a problem, one vector icon did't have assigned style (didn't have a color) in Figma. This caused an error:
2020-12-17T10:51:39+0200 info com.redmadrobot.figma-export : Using FigmaExport to export icons to Xcode project.
2020-12-17T10:51:39+0200 info com.redmadrobot.figma-export : Fetching icons info from Figma. Please wait...
2020-12-17T10:51:42+0200 info com.redmadrobot.figma-export : Processing icons...
zsh: illegal hardware instruction figma-export icons -i figma-export.yaml
After designer set the style, everything worked. Thanks.
Thanks for the info. I will add check for missing content of the icon.
Hello! Thanks for your awesome utility.
But I have a problem when using with Xcode 12.3 and figma-export 0.18.5. Everything was fine on the previous Xcode version.