title: How to fill a Table View in Swift?
body: <p>I have written this code:</p>
  
  <pre><code>//Basic methods
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
      self.DevicesTableView.registerClass(UITableViewCell.self,forCellReuseIdentifier: "cell")
      self.DevicesTableView.dataSource = self
  
  }
  
  
  var array = ["one","two"]
  
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int
  {
      return array.count
  }
  
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell
  {
      let cell: UITableViewCell! = self.DevicesTableView
          .dequeueReusableCellWithIdentifier("cell") as UITableViewCell!
  
      cell.textLabel!.text = self.array[indexPath.row]
  
      return cell
  }
  </code></pre>
  
  <p>So the code works pretty well and shows me the tableview filled with:</p>
  
  <p>Row1 "One"
  Row2 "Two"</p>
  
  <p>But how can I fill the TableView not at the beginning of my program but anytime else? I tried to call the methods below in an other function that viewDidLoad but it doest't work... why?</p>
  
  <p><code>self.DevicesTableView.registerClass(UITableViewCell.self,forCellReuseIdentifier: "cell")
   self.DevicesTableView.dataSource = self</code></p>
  
  <p>EDIT:</p>
  
  <p>I would like to display an array which isn't initialized at the beginning of my program. It contains some BLE devices after the user searched for them.</p>