AlphaWallet / AlphaWallet/alpha-wallet-ios
NSAttributedString Foreground Colours being overridden and not used in TransactionHeaderView
- Lingua principale
- Swift
- Stelle
- 631
- Fork
- 384
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione

# Problem
The foreground color in `amountTextColor` (first snippet of code) is being overridden by `Configuration.Color.Semantic.defaultHeadlineText` (fourth snippet of code). The `Colors.appHighlightGreen` and `Colors.appRed` never show up.
# First code snippet
```swift
var amountTextColor: UIColor {
switch direction {
case .incoming: return Colors.appHighlightGreen
case .outgoing: return Colors.appRed
}
}
```
This code snippet colours the text for incoming and outgoing amounts.
# Second code snippet
```swift
func amountAttributedString(for value: TransactionValue) -> NSAttributedString {
let amount = NSAttributedString(string: amountWithSign(for: value.amount), attributes: [
.font: Fonts.regular(size: 24) as Any,
.foregroundColor: amountTextColor,
])
let currency = NSAttributedString(string: " " + value.symbol, attributes: [
.font: Fonts.regular(size: 16) as Any
])
return amount + currency
}
```
This code snippet uses the colours generated by `amountTextColor`.
# Third code snippet
```swift
var fullAmountAttributedString: NSAttributedString {
return amountAttributedString(for: fullValue)
}
```
# Fourth code snippet
```swift
var amount: NSAttributedString {
NSAttributedString(string: transactionViewModel.fullAmountAttributedString.string, attributes: [
.font: Fonts.semibold(size: 20) as Any,
.foregroundColor: Configuration.Color.Semantic.defaultHeadlineText,
])
}
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.