title: SwiftUI "Cannot use instance member 'numberOfDevice' within property initializer; property initializers run before 'self' is available" error
body: <p>The bolded line (ie var text: String...) gives a &quot;Cannot use instance member 'numberOfDevice' within property initializer; property initializers run before 'self' is available&quot; error. Do I need an init? If so where? Is there a different solution?</p>
  <pre><code>struct PairView: View {
      var theClass = BluetoothManager()   
      init() {theClass.viewDidLoad()}     
  
      var body: some View {
          List {
              ForEach(0..&lt;BluetoothManager.peripheralArray.count) {   number in  //iterates thru 0 to array's count
              ConnectionView(numberOfDevice: number)      // create a ConnectionView for each number
          }
       }
    }
  }
  
  //-------
  
  struct ConnectionView: View {
      
      var numberOfDevice: Int
      **var text: String = (BluetoothManager.peripheralArray[numberOfDevice]?.name)!**  
      // 'name' is a String property of the B.M. class's array's 'numberOfDevice index.'
  
      var body: some View {
          ZStack{
              RoundedRectangle(cornerRadius: 10.0).fill(Color.blue)
              Text(text).foregroundColor(Color.black)
          }
      }
  }
  </code></pre>