Skip to content

Commit

Permalink
[Refactor] #237 - Cleanup EditClip Code
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-min committed Dec 19, 2024
1 parent b8b59c9 commit 8e32ab5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ extension EditClipViewController: UICollectionViewDataSource {
)
}
cell.changeTitleButtonTapped {
self.viewModel.cellIndex = indexPath.item - 1
self.viewModel.setupCellIndex(indexPath.item - 1)
self.editClipBottom.setupSheetPresentation(bottomHeight: 198)
self.present(self.editClipBottom, animated: true)
self.editClipBottomSheetView.setupTextField(message: self.viewModel.clipList.clips[indexPath.item - 1].title)
Expand Down
11 changes: 10 additions & 1 deletion TOASTER-iOS/Present/EditClip/ViewModel/EditClipViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import UIKit
final class EditClipViewModel: ViewModelType {

private var cancelBag = CancelBag()
var cellIndex: Int = 0

private(set) var cellIndex: Int = 0
var clipList: ClipModel = ClipModel(allClipToastCount: 0, clips: [])

// MARK: - Input State
Expand Down Expand Up @@ -90,6 +91,14 @@ final class EditClipViewModel: ViewModelType {
}
}

// MARK: - Extension

extension EditClipViewModel {
func setupCellIndex(_ index: Int) {
cellIndex = index
}
}

// MARK: - Network

private extension EditClipViewModel {
Expand Down

0 comments on commit 8e32ab5

Please sign in to comment.