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");
@@ -17,17 +17,16 @@
import SwiftUI
struct RoundedBorderTextEditor: View {
// MARK: - Properties
var title: String? = nil
var title: String?
let placeHolder: String
@Binding var text: String
var textMaxHeight: CGFloat? = nil
var error: String? = nil
var textMaxHeight: CGFloat?
var error: String?
var onTextChanged: ((String) -> Void)? = nil
var onEditingChanged: ((Bool) -> Void)? = nil
var onTextChanged: ((String) -> Void)?
var onEditingChanged: ((Bool) -> Void)?
@State private var editing = false
@@ -62,7 +61,7 @@ struct RoundedBorderTextEditor: View {
})
.showClearButton(text: $text)
// Found no good solution here. Hidding next button for the moment
// .modifier(NextViewModifier(alignment: .bottomTrailing, isEditing: $editing))
// .modifier(NextViewModifier(alignment: .bottomTrailing, isEditing: $editing))
.padding(EdgeInsets(top: 2, leading: 6, bottom: 0, trailing: 0))
.onChange(of: text, perform: { newText in
onTextChanged?(newText)
@@ -82,7 +81,7 @@ struct RoundedBorderTextEditor: View {
}
.background(RoundedRectangle(cornerRadius: 8).fill(theme.colors.background))
.overlay(RoundedRectangle(cornerRadius: 8)
.stroke(editing ? theme.colors.accent : (error == nil ? theme.colors.quinaryContent : theme.colors.alert), lineWidth: editing || error != nil ? 2 : 1))
.stroke(editing ? theme.colors.accent : (error == nil ? theme.colors.quinaryContent : theme.colors.alert), lineWidth: editing || error != nil ? 2 : 1))
.frame(height: textMaxHeight)
if let error = self.error {
Text(error)
@@ -101,7 +100,6 @@ struct RoundedBorderTextEditor: View {
struct ThemableTextEditor_Previews: PreviewProvider {
static var previews: some View {
Group {
sampleView.theme(.light).preferredColorScheme(.light)
sampleView.theme(.dark).preferredColorScheme(.dark)