mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Compound - Swift 6.2 and Main actor isolation (#5109)
* compound is now using 6.2 and main actor isolation + some tweaks to make it build tests and EX * better handling of the nonisolated context for CompoundUIColors * improving docs * fix comment * remove unused Sendable conformance
This commit is contained in:
@@ -42,7 +42,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.
|
||||
@MainActor public func override(_ keyPath: KeyPath<CompoundColorTokens, Color>, with color: Color?) {
|
||||
public func override(_ keyPath: KeyPath<CompoundColorTokens, Color>, with color: Color?) {
|
||||
overrides[keyPath] = color
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,12 @@ public extension UIColor {
|
||||
}
|
||||
|
||||
/// The colours used by Element as defined in Compound Design Tokens.
|
||||
/// This struct contains only the colour tokens in a more usable form.
|
||||
/// This class contains only the colour tokens in a more usable form.
|
||||
/// Since this can be used by attributed strings which may run in non isolated concurrent contexts,
|
||||
/// The object needs to be nonisolated.
|
||||
@Observable
|
||||
@dynamicMemberLookup
|
||||
public class CompoundUIColors {
|
||||
public final nonisolated class CompoundUIColors {
|
||||
/// The base colour tokens that form the palette of available colours.
|
||||
///
|
||||
/// Normally these shouldn't be necessary, however in practice we may need
|
||||
@@ -35,7 +37,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.
|
||||
@MainActor public func override(_ keyPath: KeyPath<CompoundUIColorTokens, UIColor>, with color: UIColor?) {
|
||||
public func override(_ keyPath: KeyPath<CompoundUIColorTokens, UIColor>, with color: UIColor?) {
|
||||
overrides[keyPath] = color
|
||||
}
|
||||
|
||||
@@ -44,7 +46,10 @@ public class CompoundUIColors {
|
||||
// swiftformat:disable numberFormatting
|
||||
/// This token is a placeholder and hasn't been finalised.
|
||||
@available(iOS, deprecated: 100000.0, message: "This token should be generated by now.")
|
||||
public let _bgCodeBlock = coreTokens.gray100
|
||||
public var _bgCodeBlock: UIColor {
|
||||
CompoundUIColors.coreTokens.gray100
|
||||
}
|
||||
|
||||
/// This token is a placeholder and hasn't been finalised.
|
||||
@available(iOS, deprecated: 100000.0, message: "This token should be generated by now.")
|
||||
public let _bgSubtleSecondaryAlpha = coreTokens.alphaGray300
|
||||
|
||||
@@ -11,7 +11,6 @@ import SwiftUIIntrospect
|
||||
public extension View {
|
||||
/// Styles a search bar text field using the Compound design tokens.
|
||||
/// This modifier is to be used in combination with `.searchable`.
|
||||
@MainActor
|
||||
func compoundSearchField() -> some View {
|
||||
introspect(.navigationStack, on: .supportedVersions, scope: .ancestor) { navigationController in
|
||||
// Uses the navigation stack as .searchField is unreliable when pushing the second search bar, during the create rooms flow.
|
||||
|
||||
Reference in New Issue
Block a user