New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[220826] TIL #115
Comments
삭제 시 문제 발생func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let favorite = UIContextualAction(style: .normal, title: "삭제") { action, view, completion in
// - 프로퍼티로 관리
// - 1. 데이터에 대한 정확성
// - 2. 가독성
let task = self.tasks[indexPath.row]
// 삭제시 같은 데이터에 대해 동시에 접근하다보면 문제가 발생할 수 있음
// - Record -> Image (문제 발생)
// - Image -> Record (순서 변경 시 문제 해결) => 근본적인 해결책은 아님.
self.removeImageFromDocument(fileName: "\(task).jpg")
try! self.realm.write {
self.realm.delete(task)
}
self.readDiary()
}
return UISwipeActionsConfiguration(actions: [favorite])
} |
tableView.beginUpdates()
tableView.endUpdates() |
|
데이터베이스 코드에 대한 정리필요성이 느껴진다면 코드를 개선해보자. 문제 상황
Repository Pattern
|
최적화https://github.com/apple/swift/blob/main/docs/OptimizationTips.rst Swift Optimization Level
WMO(Whole Module Optimization)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: