I created a simple tableview using the code below with a UITableView in the storyboard and when i lauch the iphone simulator nothing appears.
I an hoping someone help me trouble shoot this issue. thank you in advance!!!
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")!
let text = data[indexPath.row]
cell.textLabel?.text = text
return cell
}
override func viewDidLoad() {
super.viewDidLoad()
for i in 0...1000{
data.append("\(i)")
}
// Do any additional setup after loading the view.
}
private var data: [String] = []
}