I am creating a special Textfield for macOS. I want to create my own initializer, for special naming. But when I create that initializer with @Binding it gives two errors.
I don't now why it gives this initialization error. It's being clearly initialized there. Here is my code:
struct MacOSTextField: View{
    @Binding var text: String
    var displayText: String
    var body: some View{
        RoundedRectangle(cornerRadius: 0.4)
            .overlay {
                TextField(displayText, text: $text)
            }
    }
    init(text: String, displayText: String) {
        self.displayText = displayText
        self.text = text << Error: 'self' used before all stored properties are initialized
    } << Error: Return from initializer without initializing all stored properties
}
It does not work when I remove self.text = text or change the place of it. Here is the code when self.text = text is removed:
struct MacOSTextField: View{
    @Binding var text: String
    var displayText: String
    var body: some View{
        RoundedRectangle(cornerRadius: 0.4)
            .overlay {
                TextField(displayText, text: $text)
            }
    }
    init(text: String, displayText: String) {
        self.displayText = displayText
        self.text = text
    } << Error: Return from initializer without initializing all stored properties
Any help will be appreciated.
 
    