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
@@ -16,20 +16,18 @@
import SwiftUI
struct ThemableTextEditor: UIViewRepresentable {
// MARK: Properties
@Binding var text: String
@State var configuration: UIKitTextInputConfiguration = UIKitTextInputConfiguration()
@State var configuration = UIKitTextInputConfiguration()
var onEditingChanged: ((_ edit: Bool) -> Void)?
// MARK: Private
@Environment(\.theme) private var theme: ThemeSwiftUI
private let textView: UITextView = UITextView()
private let textView = UITextView()
private let internalParams = InternalParams()
// MARK: Setup
@@ -37,8 +35,8 @@ struct ThemableTextEditor: UIViewRepresentable {
init(text: Binding<String>,
configuration: UIKitTextInputConfiguration = UIKitTextInputConfiguration(),
onEditingChanged: ((_ edit: Bool) -> Void)? = nil) {
self._text = text
self._configuration = State(initialValue: configuration)
_text = text
_configuration = State(initialValue: configuration)
self.onEditingChanged = onEditingChanged
ResponderManager.register(view: textView)
@@ -63,8 +61,8 @@ struct ThemableTextEditor: UIViewRepresentable {
uiView.textColor = UIColor(theme.colors.primaryContent)
uiView.tintColor = UIColor(theme.colors.accent)
if uiView.text != self.text {
uiView.text = self.text
if uiView.text != text {
uiView.text = text
}
uiView.keyboardType = configuration.keyboardType
@@ -81,7 +79,7 @@ struct ThemableTextEditor: UIViewRepresentable {
// MARK: - Private
private func replaceText(with newText: String) {
self.text = newText
text = newText
}
private class InternalParams {
@@ -91,7 +89,7 @@ struct ThemableTextEditor: UIViewRepresentable {
// MARK: - Coordinator
func makeCoordinator() -> Coordinator {
return Coordinator(self)
Coordinator(self)
}
class Coordinator: NSObject, UITextViewDelegate {