Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,20 +15,19 @@
//
import Foundation
import SwiftUI
import Introspect
import SwiftUI
/// A bordered style of text input
///
/// As defined in:
/// https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=2039%3A26415
struct BorderedInputFieldStyle: TextFieldStyle {
@Environment(\.theme) private var theme: ThemeSwiftUI
@Environment(\.isEnabled) private var isEnabled: Bool
var isEditing: Bool = false
var isError: Bool = false
var isEditing = false
var isError = false
private var borderColor: Color {
if isError {
@@ -47,7 +46,7 @@ struct BorderedInputFieldStyle: TextFieldStyle {
}
private var textColor: Color {
if (theme.identifier == ThemeIdentifier.dark) {
if theme.identifier == ThemeIdentifier.dark {
return (isEnabled ? theme.colors.primaryContent : theme.colors.tertiaryContent)
} else {
return (isEnabled ? theme.colors.primaryContent : theme.colors.quarterlyContent)
@@ -55,18 +54,18 @@ struct BorderedInputFieldStyle: TextFieldStyle {
}
private var backgroundColor: Color {
if !isEnabled && (theme.identifier == ThemeIdentifier.dark) {
if !isEnabled, theme.identifier == ThemeIdentifier.dark {
return theme.colors.quinaryContent
}
return theme.colors.background
}
private var placeholderColor: Color {
return theme.colors.tertiaryContent
theme.colors.tertiaryContent
}
private var borderWidth: CGFloat {
return isEditing || isError ? 2.0 : 1.5
isEditing || isError ? 2.0 : 1.5
}
func _body(configuration: TextField<_Label>) -> some View {