Use the UIColors directly instead of wrapping the SwiftUI Colors. (#3324)

This commit is contained in:
Doug
2024-09-24 12:24:03 +01:00
committed by GitHub
parent d73681221d
commit c264e9e590
8 changed files with 21 additions and 11 deletions
@@ -4,6 +4,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import Compound
import SwiftUI
struct MessageComposerTextField: View {
@@ -96,7 +98,7 @@ private struct UITextViewWrapper: UIViewRepresentable {
func updateUIView(_ textView: UITextView, context: UIViewRepresentableContext<UITextViewWrapper>) {
// Prevent the textView from inheriting attributes from mention pills
textView.typingAttributes = [.font: font,
.foregroundColor: UIColor(.compound.textPrimary)]
.foregroundColor: UIColor.compound.textPrimary]
if textView.attributedText != text {
// Remember the selection if only the attributes have changed.
@@ -311,7 +313,7 @@ struct MessageComposerTextField_Previews: PreviewProvider, TestablePreview {
init(text: String) {
_text = .init(initialValue: .init(string: text, attributes: [.font: UIFont.preferredFont(forTextStyle: .body),
.foregroundColor: UIColor(.compound.textPrimary)]))
.foregroundColor: UIColor.compound.textPrimary]))
}
var body: some View {
@@ -6,6 +6,7 @@
//
import Combine
import Compound
import HTMLParser
import SwiftUI
import WysiwygComposer
@@ -207,14 +208,14 @@ enum ComposerConstant {
private extension HTMLParserStyle {
static let elementX = HTMLParserStyle(textColor: UIColor.label,
linkColor: UIColor.link,
codeBlockStyle: BlockStyle(backgroundColor: UIColor(.compound._bgCodeBlock),
borderColor: UIColor(.compound.borderInteractiveSecondary),
codeBlockStyle: BlockStyle(backgroundColor: UIColor.compound._bgCodeBlock,
borderColor: UIColor.compound.borderInteractiveSecondary,
borderWidth: 1.0,
cornerRadius: 2.0,
padding: BlockStyle.Padding(horizontal: 10, vertical: 12),
type: .background),
quoteBlockStyle: BlockStyle(backgroundColor: UIColor(.compound.iconTertiary),
borderColor: UIColor(.compound.borderInteractiveSecondary),
quoteBlockStyle: BlockStyle(backgroundColor: UIColor.compound.iconTertiary,
borderColor: UIColor.compound.borderInteractiveSecondary,
borderWidth: 0.0,
cornerRadius: 0.0,
padding: BlockStyle.Padding(horizontal: 25, vertical: 12),
@@ -173,7 +173,7 @@ class TimelineTableViewController: UIViewController {
tableView.separatorStyle = .none
tableView.allowsSelection = false
tableView.keyboardDismissMode = .onDrag
tableView.backgroundColor = UIColor(.compound.bgCanvasDefault)
tableView.backgroundColor = .compound.bgCanvasDefault
tableView.transform = CGAffineTransform(scaleX: 1, y: -1)
view.addSubview(tableView)