下面有一个tableView委托方法
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
lessonView?.lessonName = (capturedLessons?[indexPath.row].name)!
lessonView?.instructorGradedTracked = capturedLessons![indexPath.row].instructorGraded!
lessonView?.expectedCompletionTimeTracked = capturedLessons![indexPath.row].expectedCompletionTime!
self.present(self.lessonView!, animated: true, completion: nil)
}
lessonName: String
instructorGraded: Bool
expectedCompletionTime: Int
我在设置bool和int值是否为零时遇到麻烦。实施此错误处理的最佳实践方法是什么?
尝试这些安全的包装: