GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Creating a progress slider in SwiftUI for AVAudioPlayer using Combine

Forums > SwiftUI

Hi all,

I'm working on a voice recorder app, and I'm not sure how to introduce a progress slider. I wasn't able to find any good tutorials online regarding using Combine to do this. Could anyone point me in the right direction? The repo is here if you want to take a look: https://github.com/aabagdi/MemoMan/tree/main/MemoMan

Thanks!

   

Perhaps you should forget about Combine for this purpose. For a media player progress slider, the only relevant value is the latest playhead position, so there is no need to "combine" or otherwise preserve anything from previous notifications of playhead position.

If you want to use Combine for other reasons, the .switchToLatest operator may be what you are looking for.

   

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until February 9th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.