mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Run SwiftFormat and fix SwiftLint.
This commit is contained in:
@@ -33,7 +33,7 @@ public class CompoundColors {
|
||||
private var overrides = [KeyPath<CompoundColorTokens, Color>: Color]()
|
||||
|
||||
public subscript(dynamicMember keyPath: KeyPath<CompoundColorTokens, Color>) -> Color {
|
||||
return overrides[keyPath] ?? tokens[keyPath: keyPath]
|
||||
overrides[keyPath] ?? tokens[keyPath: keyPath]
|
||||
}
|
||||
|
||||
/// Customise the colour at the specified key path with the supplied colour.
|
||||
@@ -47,16 +47,17 @@ public class CompoundColors {
|
||||
self.tokens = tokens
|
||||
|
||||
decorativeColors = [
|
||||
.init(background: tokens.bgDecorative1, text: tokens.textDecorative1),
|
||||
.init(background: tokens.bgDecorative2, text: tokens.textDecorative2),
|
||||
.init(background: tokens.bgDecorative3, text: tokens.textDecorative3),
|
||||
.init(background: tokens.bgDecorative4, text: tokens.textDecorative4),
|
||||
.init(background: tokens.bgDecorative5, text: tokens.textDecorative5),
|
||||
.init(background: tokens.bgDecorative6, text: tokens.textDecorative6),
|
||||
]
|
||||
.init(background: tokens.bgDecorative1, text: tokens.textDecorative1),
|
||||
.init(background: tokens.bgDecorative2, text: tokens.textDecorative2),
|
||||
.init(background: tokens.bgDecorative3, text: tokens.textDecorative3),
|
||||
.init(background: tokens.bgDecorative4, text: tokens.textDecorative4),
|
||||
.init(background: tokens.bgDecorative5, text: tokens.textDecorative5),
|
||||
.init(background: tokens.bgDecorative6, text: tokens.textDecorative6)
|
||||
]
|
||||
}
|
||||
|
||||
// MARK: - Decorative Colors
|
||||
|
||||
// Used to determine the background and text colors of avatars, usernames etc.
|
||||
|
||||
let decorativeColors: [DecorativeColor]
|
||||
@@ -67,6 +68,7 @@ public class CompoundColors {
|
||||
|
||||
// MARK: - Awaiting Semantic Tokens
|
||||
|
||||
// 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 _borderTextFieldFocused = coreTokens.gray500
|
||||
@@ -91,6 +93,7 @@ public class CompoundColors {
|
||||
/// 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 _bgEmptyItemAlpha = coreTokens.alphaGray500
|
||||
// swiftformat:enable numberFormatting
|
||||
}
|
||||
|
||||
private extension UITraitCollection {
|
||||
@@ -107,9 +110,9 @@ private extension String {
|
||||
/// Calculates a numeric hash same as Element Web
|
||||
/// See original function here https://github.com/matrix-org/matrix-react-sdk/blob/321dd49db4fbe360fc2ff109ac117305c955b061/src/utils/FormattingUtils.js#L47
|
||||
var hashCode: Int {
|
||||
let characterCodeSum = self.reduce(0) { sum, character in
|
||||
let characterCodeSum = reduce(0) { sum, character in
|
||||
sum + Int(character.unicodeScalars.first?.value ?? 0)
|
||||
}
|
||||
return (characterCodeSum % Color.compound.decorativeColors.count)
|
||||
return characterCodeSum % Color.compound.decorativeColors.count
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2025 New Vector Ltd
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
@@ -28,7 +28,7 @@ public class CompoundUIColors {
|
||||
private var overrides = [KeyPath<CompoundUIColorTokens, UIColor>: UIColor]()
|
||||
|
||||
public subscript(dynamicMember keyPath: KeyPath<CompoundUIColorTokens, UIColor>) -> UIColor {
|
||||
return overrides[keyPath] ?? tokens[keyPath: keyPath]
|
||||
overrides[keyPath] ?? tokens[keyPath: keyPath]
|
||||
}
|
||||
|
||||
/// Customise the colour at the specified key path with the supplied colour.
|
||||
@@ -39,12 +39,14 @@ public class CompoundUIColors {
|
||||
|
||||
// MARK: - Awaiting Semantic Tokens
|
||||
|
||||
// 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
|
||||
/// 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
|
||||
// swiftformat:enable numberFormatting
|
||||
}
|
||||
|
||||
private extension UITraitCollection {
|
||||
|
||||
Reference in New Issue
Block a user