Skip to content

Commit

Permalink
Generate tokens from JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisNikolic committed Feb 25, 2025
1 parent e1f3d85 commit dc87349
Show file tree
Hide file tree
Showing 7 changed files with 2,779 additions and 17 deletions.
111 changes: 94 additions & 17 deletions Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,99 @@

//
// DesignTokens.swift
//
//
// Created by Boris on 12.2.25..
// DesignTokens.swift
//

import SwiftUI
// Do not edit directly, this file was auto-generated.


/// The model representing the design tokens fetched from the API.
/// The keys should match the JSON returned by your API.
struct DesignTokens: Decodable {
let primerColorGray100: String
let primerColorGray200: String
let primerColorBrand: String
// Add additional tokens as needed.
import SwiftUI

// Convenience computed properties to convert hex strings to SwiftUI Colors.
var colorGray100: Color { Color(hex: primerColorGray100) }
var colorGray200: Color { Color(hex: primerColorGray200) }
var colorBrand: Color { Color(hex: primerColorBrand) }
}
public class {

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - SDK

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - SDK

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - SDK

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - SDK

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - SDK

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - SDK

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - Debug App

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - Debug App

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - Debug App

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - Debug App

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - Debug App

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Unit Tests - Debug App

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Optional SDK Tests (3DS, Package.3DS.swift)

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Optional SDK Tests (3DS, Package.3DS.swift)

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Optional SDK Tests (3DS, Package.3DS.swift)

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Optional SDK Tests (3DS, Package.3DS.swift)

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Optional SDK Tests (3DS, Package.3DS.swift)

expected identifier in class declaration

Check failure on line 11 in Sources/PrimerSDK/Classes/Components/Design/DesignTokens.swift

View workflow job for this annotation

GitHub Actions / Optional SDK Tests (3DS, Package.3DS.swift)

expected identifier in class declaration
public static let PrimerColorBackground = [UIColor colorWithRed:0.090f green:0.086f blue:0.098f alpha:1.000f]
public static let PrimerColorBlue500 = [UIColor colorWithRed:0.247f green:0.576f blue:0.894f alpha:1.000f]
public static let PrimerColorBlue900 = [UIColor colorWithRed:0.290f green:0.682f blue:1.000f alpha:1.000f]
public static let PrimerColorBorderOutlinedActive = [UIColor colorWithRed:0.463f green:0.459f blue:0.467f alpha:1.000f]
public static let PrimerColorBorderOutlinedDefault = [UIColor colorWithRed:0.341f green:0.341f blue:0.341f alpha:1.000f]
public static let PrimerColorBorderOutlinedDisabled = [UIColor colorWithRed:0.259f green:0.259f blue:0.259f alpha:1.000f]
public static let PrimerColorBorderOutlinedError = [UIColor colorWithRed:0.894f green:0.427f blue:0.439f alpha:1.000f]
public static let PrimerColorBorderOutlinedFocus = [UIColor colorWithRed:0.184f green:0.596f blue:1.000f alpha:1.000f]
public static let PrimerColorBorderOutlinedHover = [UIColor colorWithRed:0.522f green:0.522f blue:0.522f alpha:1.000f]
public static let PrimerColorBorderOutlinedLoading = [UIColor colorWithRed:0.259f green:0.259f blue:0.259f alpha:1.000f]
public static let PrimerColorBorderOutlinedSelected = [UIColor colorWithRed:0.184f green:0.596f blue:1.000f alpha:1.000f]
public static let PrimerColorBorderTransparentActive = [UIColor colorWithRed:1.000f green:1.000f blue:1.000f alpha:0.000f]
public static let PrimerColorBorderTransparentDefault = [UIColor colorWithRed:1.000f green:1.000f blue:1.000f alpha:0.000f]
public static let PrimerColorBorderTransparentDisabled = [UIColor colorWithRed:1.000f green:1.000f blue:1.000f alpha:0.000f]
public static let PrimerColorBorderTransparentFocus = [UIColor colorWithRed:0.184f green:0.596f blue:1.000f alpha:1.000f]
public static let PrimerColorBorderTransparentHover = [UIColor colorWithRed:1.000f green:1.000f blue:1.000f alpha:0.000f]
public static let PrimerColorBorderTransparentSelected = [UIColor colorWithRed:1.000f green:1.000f blue:1.000f alpha:0.000f]
public static let PrimerColorBrand = [UIColor colorWithRed:0.184f green:0.596f blue:1.000f alpha:1.000f]
public static let PrimerColorFocus = [UIColor colorWithRed:0.184f green:0.596f blue:1.000f alpha:1.000f]
public static let PrimerColorGray000 = [UIColor colorWithRed:0.090f green:0.086f blue:0.098f alpha:1.000f]
public static let PrimerColorGray100 = [UIColor colorWithRed:0.161f green:0.161f blue:0.161f alpha:1.000f]
public static let PrimerColorGray200 = [UIColor colorWithRed:0.259f green:0.259f blue:0.259f alpha:1.000f]
public static let PrimerColorGray300 = [UIColor colorWithRed:0.341f green:0.341f blue:0.341f alpha:1.000f]
public static let PrimerColorGray400 = [UIColor colorWithRed:0.522f green:0.522f blue:0.522f alpha:1.000f]
public static let PrimerColorGray500 = [UIColor colorWithRed:0.463f green:0.459f blue:0.467f alpha:1.000f]
public static let PrimerColorGray600 = [UIColor colorWithRed:0.780f green:0.780f blue:0.780f alpha:1.000f]
public static let PrimerColorGray900 = [UIColor colorWithRed:0.937f green:0.937f blue:0.937f alpha:1.000f]
public static let PrimerColorGreen500 = [UIColor colorWithRed:0.153f green:0.694f blue:0.490f alpha:1.000f]
public static let PrimerColorIconDisabled = [UIColor colorWithRed:0.522f green:0.522f blue:0.522f alpha:1.000f]
public static let PrimerColorIconNegative = [UIColor colorWithRed:0.894f green:0.427f blue:0.439f alpha:1.000f]
public static let PrimerColorIconPositive = [UIColor colorWithRed:0.153f green:0.694f blue:0.490f alpha:1.000f]
public static let PrimerColorIconPrimary = [UIColor colorWithRed:0.937f green:0.937f blue:0.937f alpha:1.000f]
public static let PrimerColorLoader = [UIColor colorWithRed:0.184f green:0.596f blue:1.000f alpha:1.000f]
public static let PrimerColorRed100 = [UIColor colorWithRed:0.196f green:0.110f blue:0.125f alpha:1.000f]
public static let PrimerColorRed500 = [UIColor colorWithRed:0.894f green:0.427f blue:0.439f alpha:1.000f]
public static let PrimerColorRed900 = [UIColor colorWithRed:0.965f green:0.749f blue:0.749f alpha:1.000f]
public static let PrimerColorTextDisabled = [UIColor colorWithRed:0.522f green:0.522f blue:0.522f alpha:1.000f]
public static let PrimerColorTextLink = [UIColor colorWithRed:0.290f green:0.682f blue:1.000f alpha:1.000f]
public static let PrimerColorTextNegative = [UIColor colorWithRed:0.965f green:0.749f blue:0.749f alpha:1.000f]
public static let PrimerColorTextPlaceholder = [UIColor colorWithRed:0.463f green:0.459f blue:0.467f alpha:1.000f]
public static let PrimerColorTextPrimary = [UIColor colorWithRed:0.937f green:0.937f blue:0.937f alpha:1.000f]
public static let PrimerColorTextSecondary = [UIColor colorWithRed:0.780f green:0.780f blue:0.780f alpha:1.000f]
public static let PrimerRadiusBase = 64.00f
public static let PrimerRadiusLarge = 64.00f * 3.00
public static let PrimerRadiusMedium = 64.00f * 2.00
public static let PrimerRadiusSmall = 64.00f * 1.00
public static let PrimerRadiusXsmall = 64.00f * 0.50
public static let PrimerSizeBase = 64.00f
public static let PrimerSizeLarge = 64.00f * 6.00
public static let PrimerSizeMedium = 64.00f * 5.00
public static let PrimerSizeSmall = 64.00f * 4.00
public static let PrimerSizeXlarge = 64.00f * 8.00
public static let PrimerSizeXxlarge = 64.00f * 11.00
public static let PrimerSizeXxxlarge = 64.00f * 14.00
public static let PrimerSpaceBase = 64.00f
public static let PrimerSpaceLarge = 64.00f * 4.00
public static let PrimerSpaceMedium = 64.00f * 3.00
public static let PrimerSpaceSmall = 64.00f * 2.00
public static let PrimerSpaceXlarge = 64.00f * 5.00
public static let PrimerSpaceXsmall = 64.00f * 1.00
public static let PrimerSpaceXxsmall = 64.00f * 0.50
public static let PrimerTypographyBodyLargeFont = Inter
public static let PrimerTypographyBodyLargeLetterSpacing = -3.20f
public static let PrimerTypographyBodyLargeLineHeight = 320.00f
public static let PrimerTypographyBodyLargeSize = 256.00f
public static let PrimerTypographyBodyLargeWeight = 6400.00f
public static let PrimerTypographyBodyMediumFont = Inter
public static let PrimerTypographyBodyMediumLetterSpacing = 0.00f
public static let PrimerTypographyBodyMediumLineHeight = 320.00f
public static let PrimerTypographyBodyMediumSize = 224.00f
public static let PrimerTypographyBodyMediumWeight = 6400.00f
public static let PrimerTypographyBodySmallFont = Inter
public static let PrimerTypographyBodySmallLetterSpacing = 0.00f
public static let PrimerTypographyBodySmallLineHeight = 256.00f
public static let PrimerTypographyBodySmallSize = 192.00f
public static let PrimerTypographyBodySmallWeight = 6400.00f
public static let PrimerTypographyBrand = Inter
public static let PrimerTypographyTitleLargeFont = Inter
public static let PrimerTypographyTitleLargeLetterSpacing = -3.20f
public static let PrimerTypographyTitleLargeLineHeight = 320.00f
public static let PrimerTypographyTitleLargeSize = 256.00f
public static let PrimerTypographyTitleLargeWeight = 8800.00f
public static let PrimerTypographyTitleXlargeFont = Inter
public static let PrimerTypographyTitleXlargeLetterSpacing = -9.60f
public static let PrimerTypographyTitleXlargeLineHeight = 512.00f
public static let PrimerTypographyTitleXlargeSize = 384.00f
public static let PrimerTypographyTitleXlargeWeight = 8800.00f
}
18 changes: 18 additions & 0 deletions Sources/PrimerSDK/Classes/Components/Design/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"source": ["tokens/base.json", "tokens/dark.json"],
"platforms": {
"swift": {
"transformGroup": "ios-swift",
"files": [
{
"destination": "DesignTokens.swift",
"format": "ios-swift/class.swift",
"className": "DesignTokens",
"options": {
"accessControl": "public"
}
}
]
}
}
}
Loading

0 comments on commit dc87349

Please sign in to comment.