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

Make enums sendable for iOS #75

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## Unreleased

### Changed

## 13.0.3 - 2024-07-08

- [Patch] Make enums sendable

### Changed

## 13.0.2 - 2024-04-30

- [Patch] Upgrading SPM package version to 5.10

### Fixed

## 13.0.1 - 2023-03-28
Expand Down
14 changes: 7 additions & 7 deletions Sources/ThumbprintTokens/ThumbprintTokens.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import UIKit.UIColor

/// These are the colors we use at Thumbtack.
public enum Color {
public enum Color: Sendable {
/// Blue 100 – #eaf6fa
public static let blue100: UIColor = UIColor(red: 0.91764706, green: 0.9647059, blue: 0.98039216, alpha: 1.0)
/// Blue 200 – #b3ebff
Expand Down Expand Up @@ -89,11 +89,11 @@ public enum Color {
public static let white: UIColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
}

public enum CornerRadius {
public enum CornerRadius: Sendable {
public static let base: CGFloat = 4
}

public enum Duration {
public enum Duration: Sendable {
public static let one: TimeInterval = 0.075
public static let two: TimeInterval = 0.15
public static let three: TimeInterval = 0.2
Expand All @@ -102,12 +102,12 @@ public enum Duration {
public static let six: TimeInterval = 0.35
}

public enum FontWeight {
public enum FontWeight: Sendable {
case normal
case bold
}

public enum Font {
public enum Font: Sendable {
public static let title1Size: CGFloat = 28
public static let title1Weight: FontWeight = .bold
public static let title1UIFontTextStyle: UIFont.TextStyle = .headline
Expand Down Expand Up @@ -144,12 +144,12 @@ public enum Font {
}

/// Values for transparent light and dark curtains that cover content.
public enum Scrim {
public enum Scrim: Sendable {
public static let light80: UIColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.8)
public static let dark80: UIColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.8)
}

public enum Space {
public enum Space: Sendable {
/// Space 1 – 4.0pt
public static let one: CGFloat = 4.0
/// Space 2 – 8.0pt
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thumbtack/thumbprint-tokens",
"description": "Design variables that power Thumbtack’s UI.",
"version": "13.0.1",
"version": "13.0.3",
"main": "dist/javascript-cjs/index.js",
"module": "dist/javascript-es/index.js",
"sideEffects": false,
Expand Down
14 changes: 7 additions & 7 deletions src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ exports[`outputted iOS matches snapshot 1`] = `
import UIKit.UIColor

/// These are the colors we use at Thumbtack.
public enum Color {
public enum Color: Sendable {
/// Blue 100 – #eaf6fa
public static let blue100: UIColor = UIColor(red: 0.91764706, green: 0.9647059, blue: 0.98039216, alpha: 1.0)
/// Blue 200 – #b3ebff
Expand Down Expand Up @@ -635,11 +635,11 @@ public enum Color {
public static let white: UIColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
}

public enum CornerRadius {
public enum CornerRadius: Sendable {
public static let base: CGFloat = 4
}

public enum Duration {
public enum Duration: Sendable {
public static let one: TimeInterval = 0.075
public static let two: TimeInterval = 0.15
public static let three: TimeInterval = 0.2
Expand All @@ -648,12 +648,12 @@ public enum Duration {
public static let six: TimeInterval = 0.35
}

public enum FontWeight {
public enum FontWeight: Sendable {
case normal
case bold
}

public enum Font {
public enum Font: Sendable {
public static let title1Size: CGFloat = 28
public static let title1Weight: FontWeight = .bold
public static let title1UIFontTextStyle: UIFont.TextStyle = .headline
Expand Down Expand Up @@ -690,12 +690,12 @@ public enum Font {
}

/// Values for transparent light and dark curtains that cover content.
public enum Scrim {
public enum Scrim: Sendable {
public static let light80: UIColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.8)
public static let dark80: UIColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.8)
}

public enum Space {
public enum Space: Sendable {
/// Space 1 – 4.0pt
public static let one: CGFloat = 4.0
/// Space 2 – 8.0pt
Expand Down
3 changes: 1 addition & 2 deletions src/templates/ios.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
{{description}}
{{/if}}
public enum
{{removeSpaces this.name}}
{
{{removeSpaces this.name}}: Sendable {

Choose a reason for hiding this comment

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

This could run into problems if one of the let constants is not a Sendable type. i think so far, none are, but not sure that's guaranteed with the current set.

{{#each tokens as |token|}}
{{#if token.platforms.ios}}
{{#if token.platforms.ios.description}}
Expand Down
Loading