Add @MainActor to some of the hook points.

This commit is contained in:
Doug
2025-11-14 14:05:38 +00:00
committed by Stefan Ceriu
parent b1d2fdd122
commit 8755178cf3
8 changed files with 35 additions and 33 deletions

View File

@@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/compound-design-tokens",
"state" : {
"revision" : "be5d26dfd4ad659b0d3b3aec1ad1cccd0dc8d063",
"version" : "6.0.0"
"revision" : "93b48b3c88473562fb42c34100e45df25a4aea97",
"version" : "6.3.0"
}
},
{

View File

@@ -40,7 +40,7 @@ public class CompoundColors {
/// Customise the colour at the specified key path with the supplied colour.
/// Supplying `nil` as the colour will remove any existing customisation.
public func override(_ keyPath: KeyPath<CompoundColorTokens, Color>, with color: Color?) {
@MainActor public func override(_ keyPath: KeyPath<CompoundColorTokens, Color>, with color: Color?) {
overrides[keyPath] = color
}

View File

@@ -35,7 +35,7 @@ public class CompoundUIColors {
/// Customise the colour at the specified key path with the supplied colour.
/// Supplying `nil` as the colour will remove any existing customisation.
public func override(_ keyPath: KeyPath<CompoundUIColorTokens, UIColor>, with color: UIColor?) {
@MainActor public func override(_ keyPath: KeyPath<CompoundUIColorTokens, UIColor>, with color: UIColor?) {
overrides[keyPath] = color
}

View File

@@ -11,6 +11,7 @@ import Foundation
@testable import Compound
import XCTest
@MainActor
class OverrideColorTests: XCTestCase {
func testSwiftUI() {
let colors = CompoundColors()