title: TextField's .focused modifier not working when "out of view" SwiftUI
body: <p>I'm working with a SwiftUI <code>List</code> with a <code>TextEditor</code> at the bottom of the <code>List</code>. The <code>TextEditor</code> becomes active or &quot;Focused&quot; when a button is pressed.</p>
  <p><a href="https://i.stack.imgur.com/iEAc0m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iEAc0m.png" alt="enter image description here" /></a></p>
  <p>To achieve this, I have added a <code>.focused</code> modifier to the <code>TextEditor</code>. When the <code>List</code> is scrolled to the bottom and the <code>TextEditor</code> is visible this works as expected and shows the keyboard when the button is pressed.</p>
  <p>But the problem is that when the <code>List</code> is scrolled to the top and the <code>TextEditor</code> is not visible on the screen the <code>TextField</code> doesn't seem to get focused.</p>
  <pre><code>import SwiftUI
  
  
  struct ContentView: View {
  
      var array = Array(0...20)
  
      @State private var newItemText : String = &quot;&quot;
  
      @FocusState var focused: Bool
  
      
      var body: some View {
           
              VStack{
                  List{
                       ForEach(array, id: \.self) {
                           Text(&quot;\($0)&quot;)
                       }
                       
                      TextEditor(text: $newItemText)
                          .focused($focused)
                          
                  }
                  Button {
                      focused = true
                  } label: {
                      Text(&quot;Add Item&quot;)
                  }
                  
              }
      }
  }
  
  </code></pre>