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

[Feature]: Exported Swift code doesn't compile #132

Closed
krris opened this issue May 22, 2023 · 1 comment
Closed

[Feature]: Exported Swift code doesn't compile #132

krris opened this issue May 22, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@krris
Copy link

krris commented May 22, 2023

What happened?

Hi all 👋

I am investigating if we can use Token Studio at the current company in the iOS project. I was playing with code generation for Swift and unfortunately I wasn't able to get the output in Swift that compiles.

Reproduction

  1. Open https://configurator.tokens.studio/
  2. Don't upload tokens - use default studio.token.json that are provided as an example
  3. Add a new platform with:
  • transforms: ios-swift
  • formats: ios-swift/class.swift
  1. Click "Run Style Dictionary"

Here's the link to reproduce the issue.

Expected output

Output in Swift that compiles. Right now the generated code contains many invalid lines of code like:

public class  {
    public static let colorsBlue100 = #ebf8ff
    public static let dimensionXl = 4px * 2 * 2 * 2 * 2
    public static let fontWeightsBodyBold = Bold
    public static let exampleShadow = [object Object]
    public static let fontFamiliesHeading = Inter
}

Version

0.9.1

@krris krris added the bug Something isn't working label May 22, 2023
@jorenbroekema
Copy link
Member

Related issue: #59

We currently by default apply style-dictionary transforms on the transformGroup that are Web specific. You see this in the hex value, font family value, they would work in CSS but not other platforms.

We basically need more input from iOS developers about how these values should work in iOS context, because I am not an iOS developer myself :). I would be happy to add transforms that work for iOS/mobile context, could you elaborate on how values work in iOS for:

  • typography
  • border
  • shadow
  • color
  • dimensions

As for the [object Object] and the math expression not getting resolved, not sure why this happens with your tokens, would need to see a reproduction with some tokens and a style-dictionary config / build file.

@jorenbroekema jorenbroekema added enhancement New feature or request bug Something isn't working and removed bug Something isn't working labels May 23, 2023
@jorenbroekema jorenbroekema removed the bug Something isn't working label Oct 23, 2023
@jorenbroekema jorenbroekema changed the title [Bug]: Exported Swift code doesn't compile [Feature]: Exported Swift code doesn't compile Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants