diff --git a/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/View/SearchingMusicViewController.swift b/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/View/SearchingMusicViewController.swift index 9f896177..5fb65077 100644 --- a/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/View/SearchingMusicViewController.swift +++ b/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/View/SearchingMusicViewController.swift @@ -161,7 +161,8 @@ private extension SearchingMusicViewController { } .disposed(by: disposeBag) - self.recommendMusicSearchCollectionView.queryButtonDidTappedEvent.bind { recentQuery in + self.recommendMusicSearchCollectionView.queryButtonDidTappedEvent + .bind { recentQuery in self.searchTextField.text = recentQuery self.tableView.isHidden = false self.recentMusicSearchView.isHidden = true @@ -191,6 +192,7 @@ private extension SearchingMusicViewController { searchTextFieldEmptyEvent: searchTextFieldEmptyEvent, keyBoardDidPressSearchEventWithKeyword: keyBoardDidPressSearchEventWithKeyword, recentQueryDidPressEvent: self.recentMusicSearchScrollView.queryButtonDidTappedEvent, + recommendQueryDidPressEvent: self.recommendMusicSearchCollectionView.queryButtonDidTappedEvent, tableViewCellDidPressedEvent: selectedTableViewCellEvent ) let output = viewModel.convert(input: input, disposedBag: disposeBag) diff --git a/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/ViewModel/SearchingMusicViewModel.swift b/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/ViewModel/SearchingMusicViewModel.swift index 40887d17..76de87be 100644 --- a/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/ViewModel/SearchingMusicViewModel.swift +++ b/StreetDrop/StreetDrop/Presentation/SearchingMusicScene/ViewModel/SearchingMusicViewModel.swift @@ -28,6 +28,7 @@ final class DefaultSearchingMusicViewModel: SearchingMusicViewModel { let searchTextFieldEmptyEvent: Observable let keyBoardDidPressSearchEventWithKeyword: Observable let recentQueryDidPressEvent: PublishRelay + let recommendQueryDidPressEvent: PublishRelay let tableViewCellDidPressedEvent: Observable } @@ -94,6 +95,12 @@ final class DefaultSearchingMusicViewModel: SearchingMusicViewModel { } .disposed(by: disposedBag) + input.recommendQueryDidPressEvent + .bind { [weak self] recommendQuery in + self?.searchMusic(output: output, keyword: recommendQuery) + } + .disposed(by: disposedBag) + input.tableViewCellDidPressedEvent .bind { [weak self] indexPathRow in guard let self = self else { return }