Question: [![enter image description here](https://i.stack.imgur.com/PqaMd.jpg)](https://i.stack.imgur.com/PqaMd.jpg)

This warning is showing in the browser.

Answer: 
What you need is [TextField](https://developer.apple.com/documentation/swiftui/textfield), you have to use data model to restrict max number of characters as described in [this answer](https://stackoverflow.com/a/56477309/7356355).
I found the answer to your question. 

This solution don't use EnvironmentObject.

Please check this page.
[How to use Combine on a SwiftUI View](https://stackoverflow.com/questions/57922766/how-to-use-combine-on-a-swiftui-view)

this is my sample code.

```
import SwiftUI
import Combine
struct ContentView: View {
    @ObservedObject private var restrictInput = RestrictInput(5)
    var body: some View {
        Form {
            TextField("input text", text: $restrictInput.text)
        }
    }
}

// https://stackoverflow.com/questions/57922766/how-to-use-combine-on-a-swiftui-view
class RestrictInput: ObservableObject {
    @Published var text = ""
    private var canc: AnyCancellable!
    init (_ maxLength: Int) {
        canc = $text
            .debounce(for: 0.5, scheduler: DispatchQueue.main)
            .map { String($0.prefix(maxLength)) }
            .assign(to: \.text, on: self)
    }
    deinit {
        canc.cancel()
    }
}

```