2016-05-25 4 views
0

Я пытаюсь GET г из Github и совать их в виде таблицы, вот весь код, Gist это класс, определенный в другом месте:Неоднозначность ссылки на член «(_: numberOfRowsInSection :)»

var gists = [Gist]() 

override func viewDidAppear(animated: Bool) { 
    loadGists() 
} 

func loadGists() { 
    GithubAPIManager.sharedInstance.fetchPublicGists() { result in 
     guard result.error == nil else { 
      print("Error 1") 
      return 
     } 

     if let fetchedGists = result.value { 
      self.gists = fetchedGists 
     } 
     self.tableView.reloadData() 
     //Error here. 
    } 
} 

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
    return gists.count 
} 

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell")! 

    let gist = gists[indexPath.row] 
    cell.textLabel?.text = gist.description 
    cell.detailTextLabel?.text = gist.ownerLogin 

    return cell 
} 
+0

http://stackoverflow.com/questions/37152014/tableview-reloaddata-error-ambiguous-reference-to-member Это должно помочь. –

+0

Да, вы правы @ АнтонТарасов –

ответ

1

Итак, проблема в том, что я не добавлял выход из вида таблицы в View Controller.swift. Просто перетащил представление таблицы в файл .swift, чтобы создать его.

Смежные вопросы