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
}
}
Also in Swift:
- swift 5 only the day number from date
- swift find difference between two arrays
- can you pass an enum as a parameter to a function swift
- xcode label rotate text
- swift how to sort array
- switches xcode
- swift compare string to button title
- add buton border swift
- how to get index path cell collection view from ui longpress gesture swift
- spacing in uitextfield
- disable commit editing style swift
- array length swift
- index string swift
- swift array to string
- swift increase int value
- swift collection view check if you are at the bottom
- register for remote notifications swift
- filter text list swiftui
- swiftui font color
- swift hide navigation bar
- swift remove tableview cell
- how to unwrap arrays with optional value in swift
- swift test if simulator
- swift scrollview hide scrollbar