APP-iOS5th / FinalProject-RideThis

RideThis는 실내외 어디서든 속도, 거리, 칼로리 등의 정보를 확인하고, 기록 분석과 경쟁을 통해 성장을 추적할 수 있습니다.
https://app-ios5th.github.io/FinalProject-RideThis/
2 stars 1 forks source link

Issue #3 #38

Closed SeongKookKIM closed 1 month ago

SeongKookKIM commented 1 month ago

탭바를 엄청 빠르게 계속 움직일 시 앱이 터지는 문제

원인

해결

extension CompetitionView: UITableViewDelegate, UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.viewModel.records.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "CompetitionTVCell", for: indexPath) as! CompetitionTVCell

        // 데이터가 유효한지 확인
        guard indexPath.row < self.viewModel.records.count else {
            return UITableViewCell()
        }

        let record = self.viewModel.records[indexPath.row]
        cell.selectionStyle = .none
        cell.configure(item: record, number: indexPath.row, viewModel: self.viewModel)

        return cell
    }
}