title: Why won't the same code work on multiple instances of a Tab Bar Controller?
body: <p>I am building a weather app and It will use a tab bar controller to show different sets of weather data. Each tab bar view has a table view that is populated with cells of weather information coming from my web site. The first view (1/3) works properly. So I copied the code, changed naming conventions and tried to create the second view. However, the second view is not populating with information even though everything is the same.</p>
  <p>This is the section that works:</p>
  <pre><code>    class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
  
  //  getTemperData()
  // getWindData()
  //  getRainData()
  @IBOutlet var table: UITableView!
  var models = [TemperatureDataModel]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      
      //Register cells
      table.register(WeatherTableViewCell.nib(), forCellReuseIdentifier: WeatherTableViewCell.identifier)
      
      table.delegate = self
      table.dataSource = self
      getTemperData()
  }
  
  override func viewDidAppear(_ animated: Bool){
      super.viewDidAppear(animated)
  }
  
  //Tables
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return models.count
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: WeatherTableViewCell.identifier, for: indexPath) as! WeatherTableViewCell
      cell.configure(with: models[indexPath.row])
      return cell
      }
  
  
  func getTemperData(){
      //Create the URLs
      let temperatureDataUrl = URL(string: &quot;https://weatherstationapi.azurewebsites.net/api/TemperatureSensor/GetData&quot;)
      guard let requestURLTemp = temperatureDataUrl else {fatalError()}
      
      //Create URL request
      var request = URLRequest(url: requestURLTemp)
      //Specifiy HTTP Method to use
      request.httpMethod = &quot;GET&quot;
      request.setValue(&quot;application/json&quot;, forHTTPHeaderField: &quot;Accept&quot;)
      request.setValue(&quot;Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiaWxpci50YWlyaUB0dHUuZWR1IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZWlkZW50aWZpZXIiOiI4MjEzYzhhMy1iODgxLTQ4NmUtOGUyMC1mZmNlMDlmNGY0ZjgiLCJuYmYiOiIxNjA1MTE4NDA4IiwiZXhwIjoiMTYzNjY1NDQwOCJ9.HmLCUwnB5Esbao5NDmjflooHcdQK1BWjy1lk6LIKiJg&quot;, forHTTPHeaderField: &quot;Authorization&quot;)
      
      //Send HTTP Request
      let task = URLSession.shared.dataTask(with: request){(data, response, error) in
          guard let data = data else {print(&quot;did not get data&quot;)
              return
          }
          do
          {
              let decoder = JSONDecoder()
              decoder.keyDecodingStrategy = .convertFromSnakeCase
              let TemperatureData = try decoder.decode([TemperatureDataModel].self, from: data)
              for singleValue in TemperatureData {
                  print(singleValue.temperature)
                  self.models.append(singleValue)
                  DispatchQueue.main.async {
                      self.table.reloadData()
                  }
              }
          } catch {
              print(&quot;JSONDecoder error:&quot;, error)
          }
  
      };task.resume()
  
  }
  </code></pre>
  <p>}</p>
  <p>This section is basically the same but does not work:</p>
  <pre><code>    class TempAndHumidityController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
  @IBOutlet var windtable: UITableView!
  var Windmodels = [WindDataModel]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      //Register cells
      windtable.register(WindTableViewCell.nib(), forCellReuseIdentifier: WindTableViewCell.identifier)
      
      windtable.delegate = self
      windtable.dataSource = self
      getWindData()
  }
  
  override func viewDidAppear(_ animated: Bool){
      super.viewDidAppear(animated)
  }
  
  //Tables
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return Windmodels.count
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let windcell = tableView.dequeueReusableCell(withIdentifier: WindTableViewCell.identifier, for: indexPath) as! WindTableViewCell
      windcell.configure(with: Windmodels[indexPath.row])
      return windcell
  }
  
  
  func getWindData(){
      //Create the URLs
      let WindDataUrl = URL(string: &quot;https://weatherstationapi.azurewebsites.net/api/WindData/GetAllData&quot;)
      //Create URL requests
      guard let requestURLWind = WindDataUrl else {fatalError()}
      var requestWind = URLRequest(url: requestURLWind)
      //Request for Wind data
      requestWind.httpMethod = &quot;GET&quot;
      requestWind.setValue(&quot;application/json&quot;, forHTTPHeaderField: &quot;Accept&quot;)
      requestWind.setValue(&quot;Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiaWxpci50YWlyaUB0dHUuZWR1IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZWlkZW50aWZpZXIiOiI4MjEzYzhhMy1iODgxLTQ4NmUtOGUyMC1mZmNlMDlmNGY0ZjgiLCJuYmYiOiIxNjA1MTE4NDA4IiwiZXhwIjoiMTYzNjY1NDQwOCJ9.HmLCUwnB5Esbao5NDmjflooHcdQK1BWjy1lk6LIKiJg&quot;, forHTTPHeaderField: &quot;Authorization&quot;)
      
      
      //Send HTTP Request
      let task = URLSession.shared.dataTask(with: requestWind){(data, response, error) in
          guard let data = data else {return}
          
          do
          {
              let decoder = JSONDecoder()
            //  decoder.keyDecodingStrategy = .convertFromSnakeCase
              let WindData = try decoder.decode([WindDataModel].self, from: data)
              for singleValue in WindData {
                  print(&quot;Wind Speed:  \(singleValue.windSpeed_MPH)&quot;)
                  print(&quot;Wind Direction:  \(singleValue.windDirection)&quot;)
                  self.Windmodels.append(singleValue)
                  DispatchQueue.main.async {
                      self.windtable.reloadData()
                  }
              }
              
              //print(&quot;Temperature Data:&quot;, TemperatureData)
          } catch {
              print(&quot;JSONDecoder error:&quot;, error)
          }
      };task.resume()
      
  }
  
       }
  </code></pre>
  <p>The .xibs for the cells are all linked properly. When using breakpoints to troubleshoot, the second class gets to the HTTP request, but the data is not populating. So when I put a breakpoint at the cell.configure.... (first class) It goes through and populates each entry of the .xib. But in the second class It does not even get to the configure function. This is the configure function that works</p>
  <pre><code>    func configure(with model: TemperatureDataModel){
      self.TempLabel.text = &quot;\(Int(model.temperature))°&quot;
      self.HumidityLabel.text = &quot;\(Int(model.humidity))%&quot;
      self.dayLabel.text = &quot;\(String(model.timeCaptured))&quot;
      if #available(iOS 13.0, *) {
          self.iconImageView.image = UIImage(systemName: &quot;sun.max&quot;)
      } else {
          // Fallback on earlier versions
      }
  </code></pre>
  <p>and this is the configure function that is not being reached</p>
  <pre><code>    func configure(with model: WindDataModel){
      self.KnotsLabel.text = &quot;\(Int(model.windSpeed_Knots))&quot;
      self.MPHLabel.text = &quot;\(Int(model.windSpeed_MPH))&quot;
      self.DirectionLabel.text = &quot;\(String(model.windDirection))&quot;
      if #available(iOS 13.0, *) {
          self.iconImageView.image = UIImage(systemName: &quot;wind&quot;)
      } else {
          // Fallback on earlier versions
      }
  }
  </code></pre>
  <p>Any Ideas?</p>