使用swift在数组中显示的消息

现在,我在一个表格视图中有两个部分,当选定某行时,它会移到另一部分。当没有单元格占据该节时,是否可以显示诸如“视图为空”之类的消息,然后当单元格确实占据该节时,清除消息?

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var goalTableView: UITableView!

    let sections: [String] = ["Mark as Complete:", "History:"]
    var goals: [[String]] = [["goal 1”, “goal 2”, “goal 3”], []]

    override func viewDidLoad() {
        super.viewDidLoad()

        let headerView = UIView()
        goalTableView.tableHeaderView = headerView
        headerView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 5)


extension ViewController: UITableViewDataSource, UITableViewDelegate {

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return goals[section].count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "TodayGoalViewCell_1", for: indexPath) as? GoalTableViewCell
        cell?.goalLabel.text = goals[indexPath.section][indexPath.row]
        cell?.cellDelegate = self
        cell?.index = indexPath
        return cell!
    }

    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return sections[section]
    }

    func numberOfSections(in tableView: UITableView) -> Int {
        return goals.count
    }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        progressBarAnimation()
            if indexPath.section == 0 {
            goals[1].append(goals[0][indexPath.row])
            goals[0].remove(at: indexPath.row)
            tableView.reloadData()
        }
    }

}

extension ViewController: GoalTableView {
    func selectGoalButton(index: Int) {
    }
}