Source code :
// ContentView.swift
// TextEditor
//
// Created by Saveta Mobile Academy on 01.03.21.
//
import SwiftUI
struct ContentView: View {
@State var description = ""
var body: some View {
VStack {
Form {
Section(header: Text("Description").foregroundColor(.black), footer: HStack{
Spacer()
Text("\(String(description.count))")
.foregroundColor((description.count >= 400 ?.red : .gray))
Text("/ 400").foregroundColor(.red)
}) {
TextEditor(text: $description).disabled(description.count >= 400).frame(height: 200)
}.textCase(nil)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}