diff --git a/Segno/Segno/Presentation/ViewController/DiaryEditViewController.swift b/Segno/Segno/Presentation/ViewController/DiaryEditViewController.swift index 770013e..e50f340 100644 --- a/Segno/Segno/Presentation/ViewController/DiaryEditViewController.swift +++ b/Segno/Segno/Presentation/ViewController/DiaryEditViewController.swift @@ -330,7 +330,15 @@ extension DiaryEditViewController { } private func searchTapped() { - shazamSession.toggleSearch() + shazamSession.toggleSearch() // 지워질 예정 + viewModel.searchMusic() + .observe(on: MainScheduler.instance) + .subscribe(onSuccess: { info in + self.musicInfoLabel.text = "\(info.artist) - \(info.title)" + }, onFailure: { _ in + self.musicInfoLabel.text = "음악을 찾지 못했어요." + }) + .disposed(by: disposeBag) } } diff --git a/Segno/Segno/Presentation/ViewModel/DiaryEditViewModel.swift b/Segno/Segno/Presentation/ViewModel/DiaryEditViewModel.swift index c381c14..38152c7 100644 --- a/Segno/Segno/Presentation/ViewModel/DiaryEditViewModel.swift +++ b/Segno/Segno/Presentation/ViewModel/DiaryEditViewModel.swift @@ -25,8 +25,8 @@ final class DiaryEditViewModel { } - func searchMusic() { - + func searchMusic() -> Single { + return searchMusicUseCase.searchMusic() } func setLocation() {