title: Assign Custom TextField data in another View SwiftUI
body: <p>I am trying to assign credit card information(text: $data) through customTextField to another View.</p>
  <pre><code>struct CustomTextField: View {
      @State var data : String = &quot;&quot;
      var tFtext: String = &quot;&quot;
      var tFImage: String = &quot;&quot;
      var body: some View {
          HStack {
                  Image(tFImage)
                      .resizable()
                      .frame(width: 20, height: 20)
                      .padding()
                  TextField(tFtext, text: $data)
                      .padding()
                      .font(Font.custom(&quot;SFCompactDisplay&quot;, size: 16))
                      .foregroundColor(.black)
              }
              .background(RoundedRectangle(cornerRadius: 10))
              .foregroundColor(Color(#colorLiteral(red: 0.9647058824, green: 0.9725490196, blue: 0.9882352941, alpha: 1)))
      }
  }
  </code></pre>
  <p>To this View called CardInfo</p>
  <pre><code>struct CardInfo : View {
      var creditCard: CreditCard
      @State var isSaved: Bool = false
      var body: some View {
          VStack {
              CustomTextField(tFtext: &quot;Kartin Uzerindeki Isim&quot;, tFImage: &quot;user&quot;)
                  .textContentType(.givenName)
              creditCard.cardOwnerName = CustomTextField.text
  </code></pre>
  <p>But CustomTextField.text won't work. How can I pull those texts from textfield?<a href="https://i.stack.imgur.com/EAOJp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EAOJp.png" alt="enter image description here" /></a></p>