Post

Replies

Boosts

Views

Activity

Reply to MPMediaItemPropertyArtwork crashes on Swift 6
Hello Quinn! setMetadata(...) is set inside the @MainActor class AudioPlayerProvider: ObservableObject along AVPlayer and some @Published properties. The function itself can be called inside the action of a SwiftUI button with: Task { try? await self.audioPlayerProvider.setMetadata(title: ..., artist: ..., artwork: ...) } or inside a .onChange event triggered by a metadata ObservableObject class, when needed. So always on the thread the enclosing view runs. Thanks again
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’24
Reply to MPMediaItemPropertyArtwork crashes on Swift 6
Hello Quinn! setMetadata(...) is set inside the @MainActor class AudioPlayerProvider: ObservableObject along AVPlayer and some @Published properties. The function itself can be called inside the action of a SwiftUI button with: Task { try? await self.audioPlayerProvider.setMetadata(title: ..., artist: ..., artwork: ...) } or inside a .onChange event triggered by a metadata ObservableObject class, when needed. So always on the thread the enclosing view runs. Thanks again
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’24