Hi all,
I am trying to understand how to show the AirPlay menu in SwiftUI. My goal is to show the AirPlay menu, the same one displayed in the music app, but programmatically from a SwiftUI Button.
I was able to display the AirPlay menu using UIViewRepresentable and MPVolumeView, but that does not show the currently active AirPlay speakers (no checkmarks).
So how can I:
Show the AirPlay button from a custom SwiftUI button?
Show the same AirPlay menu as the one in the Music app, with preselected active speaker?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
I am trying to get recommendations based on the identifier of multiple tracks. But I am unable to get any results
Here is the code I have used to try to get recommendations based on one album
let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: URL(string: "https://api.music.apple.com/v1/me/recommendations/1571344275")!))
let dataResponse = try await dataRequest.response()
For this I am getting the response:
Failed to perform MusicDataRequest.Context(
url: https://api.music.apple.com/v1/me/recommendations/1571344275,
currentRetryCounts: [.other: 1]
) with MusicDataRequest.Error(
status: 404,
code: 40400,
title: "Resource Not Found",
detailText: "Resource with requested id was not found",
I have tried used the identifier of songs/albums, to no success. What am I doing wrong?
Hi Apple Engineers,
I noticed in iOS 16, PlayParameters which part of every Track that has been added/downloaded to the library, now includes two new properties isLibrary & musicKit_persistentID . Unfortunately, these create backward compatibility error when trying to decode the Track object on iOS 15.
I make collaborative playlist app, which stores the Track added by User A which now includes the unique identifier for the locally downloaded file, when attempted to be played by User B won't play any music due to mismatching identifiers (even when everyone is on iOS 16).
This essentially breaks the entire functionality of my app due to these new properties.
Steps:
Store a Track (which has been added to library) as a JSON object from iOS 16
Decode the JSON on iOS 15
Expected Results:
New PlayParameters variables should be optional, to support backwards compatibility with iOS 15 and to support collaborative uses cases.
Actual Results:
New PlayParameters automatically include two new values that cause decoding errors.
I request that at least for an option to ignore the new properties in the PlayParameters in iOS 16.
Here is my feedback: FB11362589
Hi Apple Engineers,
I am reporting an issue in iOS 16.1 and iOS 16.2 beta 3 where setting the shuffleMode for ApplicationMusicPlayer is no longer working
Here is the code:
let player = ApplicationMusicPlayer.shared
let tracks = [Tracks]
player.queue = ApplicationMusicPlayer.Queue(for: tracks)
player.state.shuffleMode = .songs
Task.init {
try await player.play()
}
I tested the same code on iOS 15 and it works as expected.
Here is the related ticket: FB11840279
Currently in iOS 15 beta 2, you can the search suggestions to complete a search term, but is there a way that when the user select a suggestion, not only does it complete the term but also performs a .onSubmit?
So that without having to hitting search on the keyboard, we can programmatically trigger a onSubmit?
Hi there,
I would like to make the navigation bar clear in my view.
Currently I am using the init() method to achieve this:
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: UIBarMetrics.default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().isTranslucent = true
UINavigationBar.appearance().tintColor = .clear
UINavigationBar.appearance().backgroundColor = .clear
But this makes the navigation bar clear app-wide.
How can I make the navigation bar clear for specific view and ensure that view navigating to other views/popping modal they are returned to the default values?
P.S I tried using the onAppear method and that doesn't do anything.
Hi all,
I have an app where I am displaying a list of item in a view. Problem is that the main thread is often getting blocked when I start scrolling.
Here is what I getting from using Profiler.
I understand that CATransaction has to do with animation, but could someone help me understand in simple terms what is happening here?
Hi Apple Engineers,
I am reporting a issue that has surfaced in iOS 16.1 and iOS 16.2 beta, where when you have a long list of Tracks that are in the label of a Buttons, they are are displayed correctly.
They appear intermittently, after you scroll they disappear (placeholder is shown) and it required a state change to display the final artwork correctly
Here is code:
let tracks = [Track]
//With Issue
List(tracks) { track in
Button {
//ACTION BLOCL
} label: {
if let artwork = track.artwork {
ArtworkImage(artwork: artwork, width: 50, height: 50)
} else { PlaceholderView() }
}
}
//Without Issue
List(tracks) { track in
if let artwork = track.artwork {
ArtworkImage(artwork: artwork, width: 50, height: 50)
} else { PlaceholderView() }
}
Same code works correctly on iOS 15 and also when ArtworkImage is not used inside a button.
Here is the related ticket: FB11840336
Topic:
Media Technologies
SubTopic:
General
Tags:
MusicKit
Apple Music API
wwdc2022-10148
wwdc2022-110347
Fetching the featured artists in a playlist, no longer works in iOS 26.1 beta
let detailedPlaylist = try await playlist.with([.tracks, .featuredArtists], preferredSource: .library)
Throws error when using .library and using .catalog returns empty array.
This works correctly in iOS 26.0 and iOS 18 versions