Skip to content

Commit

Permalink
#156 feat: 음악 검색 결과를 뷰 모델로부터 받아오는 로직 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantchoi committed Dec 6, 2022
1 parent c678c90 commit 222b58f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Segno/Segno/Presentation/ViewModel/DiaryEditViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ final class DiaryEditViewModel {

}

func searchMusic() {

func searchMusic() -> Single<MusicInfo> {
return searchMusicUseCase.searchMusic()
}

func setLocation() {
Expand Down

0 comments on commit 222b58f

Please sign in to comment.