Answers for "making table view with data in swift"

2

swift table view needs

func setTableNeeds(){
        tableView.delegate = self
        tableView.dataSource = self
        let nib = UINib(nibName: "cell", bundle: nil)
        tableView.register(nib, forCellReuseIdentifier: "cell")
    }
extension NameOfUIViewController: UITableViewDelegate, UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10 //number of cells
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! Cell //CustomCell Name if the is one
        //cell.blah = blah or cell.blah(blah: blah).....
        return cell
    }
}
Posted by: Guest on June-03-2020

Code answers related to "making table view with data in swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language