Bug fix

Hello, I have these two errors in this particular block of code: Capture of 'self' with non-sendable type 'MusicPlayer?' in a @Sendable closure and Capture of 'localUpdateProgress' with non-sendable type '(Double, Double) -> Void' in a @Sendable closure ` @MainActor func startProgressTimer(updateProgress: @escaping (Double, Double) -> Void) { timer?.invalidate() // Stop any existing timer let localUpdateProgress = updateProgress

     timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { [weak self] _ in
         guard let self = self,
               let audioPlayer = self.audioPlayer,
               let currentItem = audioPlayer.currentItem else {
             print("currentItem is nil or audioPlayer is unavailable")
             return
         }

         let currentTime = currentItem.currentTime().seconds
         let duration = currentItem.duration.seconds
        localUpdateProgress(currentTime, duration)
     }
 }`

I've tried nearly every solution and can't think of one that works. Any help is greatly appreciated :)

Bug fix
 
 
Q