From 633049d2bf93037fd14efca1b5b4e42c897714eb Mon Sep 17 00:00:00 2001 From: zaehorang Date: Sun, 7 Jul 2024 20:36:33 +0900 Subject: [PATCH] fix: Update `isPlaying` on main thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 뷰와 관련된 published 프로퍼티의 값 변경을 메인 스레드에서 하도록 수정 --- MinGenie/MinGenie/Playback/MusicPlayerModel.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MinGenie/MinGenie/Playback/MusicPlayerModel.swift b/MinGenie/MinGenie/Playback/MusicPlayerModel.swift index 1642975..25de7e5 100644 --- a/MinGenie/MinGenie/Playback/MusicPlayerModel.swift +++ b/MinGenie/MinGenie/Playback/MusicPlayerModel.swift @@ -248,7 +248,9 @@ final class MusicPlayerModel: ObservableObject { } private func handlePlaybackStateDidChange() { - isPlaying = (musicPlayer.state.playbackStatus == .playing) + DispatchQueue.main.async { + self.isPlaying = (self.musicPlayer.state.playbackStatus == .playing) + } } }