title: SwiftUI on tvOS: How to know which item is selected in a list
body: <p>In a list, i need to know which item is selected and this item have to be clickable.</p>
  
  <p>This is what i try to do:</p>
  
  <pre><code>| item1 | info of the item3 (selected) |
  | item2 |                              |
  |*item3*|                              |
  | item4 |                              |
  </code></pre>
  
  <p>I can make it with <code>.focusable()</code> but it's not clickable.</p>
  
  <p><code>Button</code> or <code>NavigationLink</code> works but i can't get the current item selected.</p>
  
  <p>When you use <code>Button</code> or <code>NavigationLink</code> <code>.focusable</code> don't hit anymore.</p>
  
  <p>So my question is:</p>
  
  <p>How i can get the current item selected (so i can display more infos about this item) and make it clickable to display the next view ?</p>
  
  <p><strong>Sample code 1</strong>: Focusable works but <code>.onTap</code> doesn't exists on tvOS</p>
  
  <pre><code>import SwiftUI
  
  struct TestList: Identifiable {
      var id: Int
      var name: String
  }
  
  let testData = [Int](0..&lt;50).map { TestList(id: $0, name: "Row \($0)")  }
  
  
  struct SwiftUIView : View {
      var testList: [TestList]
  
      var body: some View {
          List {
              ForEach(testList) { txt in
                  TestRow(row: txt)
              }
          }
      }
  }
  
  struct TestRow: View {
      var row: TestList
  
      @State private var backgroundColor = Color.clear
  
      var body: some View {
          Text(row.name)
          .focusable(true) { isFocused in
              self.backgroundColor = isFocused ? Color.green : Color.blue
              if isFocused {
                  print(self.row.name)
              }
          }
          .background(self.backgroundColor)
      }
  }
  </code></pre>
  
  <p><strong>Sample code 2</strong>: items are clickable via <code>NavigationLink</code> but there is no way to get the selected item and <code>.focusable</code> is not called anymore.</p>
  
  <pre><code>import SwiftUI
  
  struct TestList: Identifiable {
      var id: Int
      var name: String
  }
  
  let testData = [Int](0..&lt;50).map { TestList(id: $0, name: "Row \($0)")  }
  
  
  struct SwiftUIView : View {
      var testList: [TestList]
  
      var body: some View {
          NavigationView {
              List {
                  ForEach(testList) { txt in
                      NavigationLink(destination: Text("Destination")) {
                          TestRow(row: txt)
                      }
                  }
              }
          }
      }
  }
  
  struct TestRow: View {
      var row: TestList
  
      @State private var backgroundColor = Color.clear
  
      var body: some View {
          Text(row.name)
          .focusable(true) { isFocused in
              self.backgroundColor = isFocused ? Color.green : Color.blue
              if isFocused {
                  print(self.row.name)
              }
          }
          .background(self.backgroundColor)
      }
  }
  </code></pre>