swift:TableView
TableViewは設定をミスると一生表示されないどころかAppDelegateで落ちてしまうので要注意です。

まず普通にstoryboardからTableViewをセットします。
でコードも書いていきます。
sample.swift
import UIKit
class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
let sampleList = ["にんじん","じゃがいも","豚肉","ルー"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return sampleList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell :UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell",for: indexPath)
cell.textLabel!.text = sampleList[indexPath.row]
return cell
}
}
ソースはこれで特に問題ないですがこれでは何も表示されません。

ここから設定を変更すれば表示されます。

まずここのdataSourceとdelegateの設定をします。
どうするかと言うと、、、
— Mr.Brooks (@MrBrook27743251) September 8, 2019

そして次にIdentifierを設定します。

今回
sample.swift
let cell :UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell",for: indexPath)
withIdentifier: "cell"なのでIdentifierは同じくcellに設定します。
これで表示がされるはずです。

うまくできました。
設定もした上でソースを書いていくことを忘れないようにしないといけませんね。