From abad439812f3c6996f842aa9bbd45cb334caed8d Mon Sep 17 00:00:00 2001 From: Kyxxn Date: Wed, 20 Nov 2024 09:39:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=ED=8E=B8=EC=A7=91=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Category/CategoryViewController.swift | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Category/CategoryViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Category/CategoryViewController.swift index 6e7a6a97..49b639ee 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Category/CategoryViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Category/CategoryViewController.swift @@ -70,6 +70,7 @@ final class CategoryViewController: UIViewController { color: .mhTitle ) { [weak self] in // TODO: 편집하기 + self?.categoryTableView.setEditing(true, animated: true) } // 우측 추가 버튼 @@ -93,7 +94,7 @@ extension CategoryViewController: UITableViewDelegate { _ tableView: UITableView, didSelectRowAt indexPath: IndexPath ) { - + // TODO: 카테고리 선택 시 로직 필요 } func tableView( @@ -102,6 +103,36 @@ extension CategoryViewController: UITableViewDelegate { ) -> CGFloat { CategoryTableViewCell.height } + + func tableView( + _ tableView: UITableView, + canEditRowAt indexPath: IndexPath + ) -> Bool { + indexPath.row >= 2 + } + + func tableView( + _ tableView: UITableView, + trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath + ) -> UISwipeActionsConfiguration? { + let editAction = UIContextualAction( + style: .normal, + title: "수정" + ) { [weak self] _, _, completion in + // TODO: 수정 로직 + } + + let deleteAction = UIContextualAction( + style: .destructive, + title: "삭제" + ) { [weak self] _, _, completion in + // TODO: 삭제 로직 + } + + return UISwipeActionsConfiguration( + actions: [deleteAction, editAction] + ) + } } extension CategoryViewController: UITableViewDataSource {