[Feat] #226 - 클립 이동 제한 로직 및 버튼 액션 추가 #227
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ 해결한 이슈
🛠️ 작업내용
🖥️ 주요 코드 설명
이동할 클립이 존재하지 않을때
ChangeClipViewModel
링크 이동시에 이동할 클립이 존재하지 않을때의 로직을 구현했습니다.
이동할 클립을 해당 API 로 불러 오는데 개수가 2개 미만일 경우 nil 을 반환하도록 구현했습니다. 반환값도 옵셔널을 추가해주었습니다.
DetailClipViewController
DetailClipViewController
에서 nil 값을 반환 받을 때 동작하는 로직을 추가했습니다.다음과 같이 ToastMessage 를 출력하도록 변경하였습니다.
버튼 액션 추가
기존 로직은 VC 에서
ChangeClipBottomSheetView
의 버튼 액션을 Delegate 로 전달 받고 changeCategoryResult Publisher 로 이벤트를 전달하여 버튼 액션을 구현하고 있었습니다.다만 고민이 됐던 부분은 버튼 액션을 처리하기 위해 task 탈출 클로저가 존재했는데 링크 이동 관련 로직은 MVVM (Input, output) 구조로 되어있어 API 를 호출하기 어려운 상황이였습니다.
하위 View 에서 ViewModel 과 Combine 을 사용하지 않는 것을 목표로 삼고 있어서 기존의 Delegate 를 살리고자 다음과 같이 구현했습니다.
Task 구문에서 직접 API 를 호출하지 않고 기존과 동일하게 VC 에서 처리할 수 있도록 구현했습니다.
✅ Checklist