Search results for

“swiftui”

17,233 results found

Post

Replies

Boosts

Views

Activity

Reply to Why doesn’t Transaction.updates emit reliably?
My app is a Mac app that uses the AppKit framework. It is not a SwiftUI app, nor is it an iOS app. It uses SwiftUI for some views. The sample project code is similar to my code snippet but is built using the SwiftUI design pattern. I want Transaction.updates and Product.SubscriptionInfo.Status.updates to work, but they are not detecting the changes I make when I make purchases, nor are they detecting purchases when using the Xcode Transaction Manager. Also, I use subscriptionStatusTask(for:priority:action:) modifier where I use ProductView and it doesn't work. It is supposed to react in real time. It works if I reload the view by switching to another view and then back. I believe it is less to do with the code and is something else. Maybe the Xcode project file settings is messed up or I am missing something. I tried restarting the Mac and clearing the derived data. Likewise, as I mentioned, it works perfectly in a fresh Xcode project with a minimal setup, but it doesn’t work in my
Topic: App & System Services SubTopic: StoreKit Tags:
Feb ’26
Swiftui Map Leagal Text is transformed when rotationEffect is applied to Map
I have a problem when applying rotationEffect to a map in in SwiftUI. The legal text in the map is transformed as shown in this image: The following code is part of a much larger and complex view; it is a minimal example to reproduce the error: import SwiftUI import MapKit struct ContentView: View { @State private var offset = CGSize.zero var body: some View { ZStack { let drag = DragGesture() .onChanged { g in offset.width = g.translation.width offset.height = g.translation.height } Map(interactionModes: [.zoom]) .frame(width: 320, height: 220) .rotationEffect(.degrees(Double(offset.width / 12))) .highPriorityGesture(drag) } } } I hope you can help me with this problem.
2
0
176
Feb ’26
How do I control a SwiftUI TextField with a game controller?
I've coded a text-adventure game in SwiftUI. (My game has no graphics or sound effects.) My app already supports keyboard navigation; I would like to add support for game controllers on iPhone. I can't figure out how to do it. I especially can't see any way to allow controller users to enter text in a TextField. I've read https://developer.apple.com/documentation/gamecontroller/supporting-game-controllers and it's all about button events. There's no reference to SwiftUI at all in that documentation, or any input-method editing at all. The only mention of keyboard is about treating the keyboard itself as if it were a game controller providing button events. How do I implement this?
0
0
264
Feb ’26
protocol witness error in Playgrounds
I'm importing SwiftUI, Foundation and Charts into an iOS app I'm writing in Swift in Xcode Playgrounds and am getting this error: error: Couldn't look up symbols: protocol witness table for Foundation.Date : Charts.Plottable in Charts the code looks like this in just two example files: file 1, the view import Foundation import SwiftUI import Charts import PlaygroundSupport struct FirstChart_WithDates: View { private let data = ChartDateAndDoubleModel.mockData(months: 3) var body: some View { Chart(data) { item in BarMark( x: .value(Label, item.date, unit: .month), y: .value(Value, item.value) ) } .padding() .aspectRatio(1, contentMode: .fit) .dynamicTypeSize(.accessibility1) ChartDateAndDoubleModelView(data: data) } } struct ChartDateAndDoubleModelView: View { var data: [ChartDateAndDoubleModel] var body: some View { VStack { HeaderRowView(texts: [date, value]) ForEach(data) { datum in HStack { Text(datum.date.formatted(date: .abbreviated, time: .omitted)) .frame(maxWidth: .infinity) // TODO
1
0
251
Feb ’26
SwiftUI toolbar items clip DocumentGroup rename affordance
Hi — I’m seeing the DocumentGroup rename/title affordance get clipped on iPad when I populate the navigation bar with SwiftUI toolbar items in .topBarLeading, .principal, and .topBarTrailing (trailing is an HStack of controls). Example: .toolbar { ToolbarItem(placement: .topBarLeading) { UndoRedoControlsView(...) } ToolbarItem(placement: .principal) { Text(canvasInfoTitle).lineLimit(1) } ToolbarItem(placement: .topBarTrailing) { HStack { ... } } } .navigationBarTitleDisplayMode(.inline) Is there a recommended way to structure toolbar content so the system’s document title/rename control always has space (or a way to reserve space / avoid clipping), short of removing .principal or moving items into menus?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
44
Feb ’26
Vision OS Persona
I’m seeing a camera/capture routing issue on visionOS when multiple WindowGroups are open at the same time. I have a SwiftUI view that starts an AVCaptureSession on onAppear and stops it on onDisappear. The camera feed is displayed in a subview that only exists inside one window. However, when I open additional windows (other WindowGroups) in the same app, the camera perspective/route changes unexpectedly — it looks like the capture is being re-associated with a different scene/window, even though the camera view never moved and no other view starts capture. Expected behavior Opening additional windows should not affect the active capture session or camera routing for the existing camera view. The camera feed should remain stable and tied to the window hosting. Actual behavior When multiple windows are open, the camera feed “switches perspective” / appears to re-route, as if the system changes which scene is considered active for capture. This happens without any explicit code calling startSession()
0
0
66
Feb ’26
String Catalog Symbols: No Reference-Language Fallback for Partially Translated Locales
I'm having troubles converting my string catalog to symbols because for partly translated languages there is no fallback to the reference language. Let me give you an example. Example Assume an app that supports two languages: English and Japanese. The app is very simple and has only two strings, using symbols in a String Catalog: Key: .helloWorld → “Hello World!” Key: .info → “Information” Case 1: No Japanese translations If I launch the app in Japanese and neither string is translated, English is used as a fallback. The UI shows: “Hello World!” “Information” This is exactly what I would expect. Case 2: Only one string translated Now assume I translate only one string into Japanese: .helloWorld → “こんにちは世界” When I launch the app in Japanese now: .helloWorld correctly shows “こんにちは世界” .info shows info, not “Information” So instead of falling back to English, the key is displayed. This issue does not pop up when I don't use symbols. Because then, my SwiftUI Text elements contain the English ideal text a
1
0
297
Feb ’26
VideoMaterial Black Screen on Vision Pro Device (Works in Simulator)
VideoMaterial Black Screen on Vision Pro Device (Works in Simulator) App Overview App Name: Extn Browser Bundle ID: ai.extn.browser Purpose: A visionOS web browser that plays 360°/180° VR videos in an immersive sphere environment Development Environment & SDK Versions Component Version Xcode 26.2 Swift 6.2 visionOS Deployment Target 26.2 Swift Concurrency MainActor isolation enabled App is released in the TestFlight. Frameworks Used SwiftUI - UI framework RealityKit - 3D rendering, MeshResource, ModelEntity, VideoMaterial AVFoundation - AVPlayer, AVAudioSession WebKit - WKWebView for browser functionality Network - NWListener for local proxy server Sphere Video Mechanism The app creates an immersive 360° video experience using the following approach: // 1. Create sphere mesh (10 meter radius for immersive viewing) let mesh = MeshResource.generateSphere(radius: 10.0) // 2. Create initial transparent material var material = UnlitMaterial() material.color = .init(tint: .clear) // 3. Create entity an
0
0
332
Feb ’26
Reply to How to accept CloudKit shares with the new SwiftUI app lifecycle?
CloudKit share acceptance still requires a UIWindowSceneDelegate on iOS. Can try this approach ---- Keep SwiftUI lifecycle @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } Add SceneDelegate import UIKit import CloudKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { func windowScene( _ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith metadata: CKShare.Metadata ) { acceptShare(with: metadata) } } Register it in Info.plist UISceneDelegateClassName = SceneDelegate
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
Reply to How to animate `UIHostingController.view` frame when my View's size changes?
@DTS Engineer I am expecting the part on the left, in SwiftUI to animate exactly like the counterpart in UIKit on the right. But they do not; UIKit animation affects both UIView.center and UIView.bounds, and they travel using the same timing curve over the same duration, which makes it seem that the top of the UIKit view is attached to the top of the screen. However, this illusion is not preserved for SwiftUI view because UIHostingController.view.center is not animated; it's teleported to the end position. And I also happen to know that really bounds are not animated either, the UIView actually just fully teleports to the new state, while only the SwiftUI content is animated. And my question is - what is the way to make UIHostingController animate along its SwiftUI content? Can you maybe confirm that there isn't a built-in support for that?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
Accept a Review Rejection Defeat or Play Along with Reviewer
I have a desktop application developed in SwiftUI that shows property locations on the map. That's NOT the main feature. IF you give the application permission to access your location, the blue dot will appear on the map. If you don't, the blue user dot won't appear. That's the only difference with location services. In other words, the application has no use of user's current position beyond showing it on the map. Since it's just the matter of showing or not showing the blue dot on the map, the application doesn't really need to use the location service. Anyway, the reviewer is talking about something else by rejecting the application in two aspects. Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage Guideline 5.1.5 - Legal - Privacy - Location Services As I said earlier, the application only wants to show the blue dot on the map so that you can see your property locations relative to your current location. In code, it's something like the following. Map(position: $propertyViewModel.map
3
0
258
Feb ’26
Reply to Image not rendering on some devices
Hello @thisisjaymehta, Welcome to SwiftUI development! 🥳 The first thing I would look at is the Attributes menu, located in the Inspector area (the sidebar on the right of Xcode). You can also quickly open this tab by pressing ⌥ ⌘ 4. In that menu you will notice options for devices, appearances, sizes and more. In your screenshot, it appears you have the Scales set to Single Scale. You can try switching this to Individual Scale and add different scales which are configured to show on different devices. You can find more information about how to do that here Fitting images into available space If not, try appearances and see if it's a light/dark mode issue. It looks like you already did some troubleshooting by setting a solid white color background. A great tip you can use to check both color schemes easily is by using this toggle at the bottom of the canvas in Xcode, which will show both the light and dark move preview in Canvas. For more information on Xcodes canvas see Previewing your app’s interf
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
Reply to How to animate `UIHostingController.view` frame when my View's size changes?
Hello @isaacweisberg, I see the UIKit example on the right is animating correctly to me. It looks like you followed the steps correctly: Line 75 of ViewController.swift the UIHostingController observes .preferredContentSize. Nice work on implementing that! 😎👍 Can you clarify on what you mean? Are you trying to achieve the same effect in SwiftUI or is the UIKit example on the right not what you were looking for? Let me know,  Travis Trotto - DTS Engineer
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
Reply to Can I disable a SwiftUI View from being a draggable source, but still leave it enabled as a dropDestination?
Sorry for the delay, I didn't get the notification. Thanks for the code, I would recommend to add a link to a focused project where I can download and play with it as of course without the images nor drop targets is hard to see what you are trying to accomplish and will help many developers here figure it out. Customize the drag preview to make the interaction more intuitive. You can modify the draggable modifier .draggable(player, preview: { VStack { Image(jersey) .resizable() .frame(width: 50, height: 50) if let player = content.player { Text(player.last) .font(.caption) } } }) Currently, the drop handler just prints the item. You might want to update the CellContent's player based on the drop? .dropDestination(for: String.self) { items, location in if let firstItem = items.first { print(Dropped: (firstItem)) // Update player logic here if needed // e.g., content.player = updatedPlayerBasedOn(firstItem) } return true } Looking forward to your focused sample. That'll help us better understand what's going on
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
MusicKit + AirPlay
Hello, I'm working on a MusicKit based SwiftUI app. I've integrated AirPlay using the AVRoutePickerView like so: struct UIKitAirPlayPickerView: UIViewRepresentable { func makeUIView(context: Context) -> AVRoutePickerView { let routePickerView = AVRoutePickerView() routePickerView.prioritizesVideoDevices = false return routePickerView } func updateUIView(_ uiView: AVRoutePickerView, context: Context) {} } The AirPlay menu appears as expected, and selecting an AirPlay device functions as expected. I'm currently sending audio from my app to a HomePod. However, the state of the AVRoutePickerView does not reflect the playback state. There is no cover art and it says Not Playing. When my device is locked, my lock screen shows the album art, metadata and AirPlay routing as expected. My app uses the ApplicationMusicPlayer however I encounter the same behavior using the SystemMusicPlayer. Any guidance on how to troubleshoot this? Is there any other way to integrate the system AirPlay picker into my app, or
1
0
573
Feb ’26
Reply to Why doesn’t Transaction.updates emit reliably?
My app is a Mac app that uses the AppKit framework. It is not a SwiftUI app, nor is it an iOS app. It uses SwiftUI for some views. The sample project code is similar to my code snippet but is built using the SwiftUI design pattern. I want Transaction.updates and Product.SubscriptionInfo.Status.updates to work, but they are not detecting the changes I make when I make purchases, nor are they detecting purchases when using the Xcode Transaction Manager. Also, I use subscriptionStatusTask(for:priority:action:) modifier where I use ProductView and it doesn't work. It is supposed to react in real time. It works if I reload the view by switching to another view and then back. I believe it is less to do with the code and is something else. Maybe the Xcode project file settings is messed up or I am missing something. I tried restarting the Mac and clearing the derived data. Likewise, as I mentioned, it works perfectly in a fresh Xcode project with a minimal setup, but it doesn’t work in my
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
Feb ’26
Swiftui Map Leagal Text is transformed when rotationEffect is applied to Map
I have a problem when applying rotationEffect to a map in in SwiftUI. The legal text in the map is transformed as shown in this image: The following code is part of a much larger and complex view; it is a minimal example to reproduce the error: import SwiftUI import MapKit struct ContentView: View { @State private var offset = CGSize.zero var body: some View { ZStack { let drag = DragGesture() .onChanged { g in offset.width = g.translation.width offset.height = g.translation.height } Map(interactionModes: [.zoom]) .frame(width: 320, height: 220) .rotationEffect(.degrees(Double(offset.width / 12))) .highPriorityGesture(drag) } } } I hope you can help me with this problem.
Replies
2
Boosts
0
Views
176
Activity
Feb ’26
How do I control a SwiftUI TextField with a game controller?
I've coded a text-adventure game in SwiftUI. (My game has no graphics or sound effects.) My app already supports keyboard navigation; I would like to add support for game controllers on iPhone. I can't figure out how to do it. I especially can't see any way to allow controller users to enter text in a TextField. I've read https://developer.apple.com/documentation/gamecontroller/supporting-game-controllers and it's all about button events. There's no reference to SwiftUI at all in that documentation, or any input-method editing at all. The only mention of keyboard is about treating the keyboard itself as if it were a game controller providing button events. How do I implement this?
Replies
0
Boosts
0
Views
264
Activity
Feb ’26
protocol witness error in Playgrounds
I'm importing SwiftUI, Foundation and Charts into an iOS app I'm writing in Swift in Xcode Playgrounds and am getting this error: error: Couldn't look up symbols: protocol witness table for Foundation.Date : Charts.Plottable in Charts the code looks like this in just two example files: file 1, the view import Foundation import SwiftUI import Charts import PlaygroundSupport struct FirstChart_WithDates: View { private let data = ChartDateAndDoubleModel.mockData(months: 3) var body: some View { Chart(data) { item in BarMark( x: .value(Label, item.date, unit: .month), y: .value(Value, item.value) ) } .padding() .aspectRatio(1, contentMode: .fit) .dynamicTypeSize(.accessibility1) ChartDateAndDoubleModelView(data: data) } } struct ChartDateAndDoubleModelView: View { var data: [ChartDateAndDoubleModel] var body: some View { VStack { HeaderRowView(texts: [date, value]) ForEach(data) { datum in HStack { Text(datum.date.formatted(date: .abbreviated, time: .omitted)) .frame(maxWidth: .infinity) // TODO
Replies
1
Boosts
0
Views
251
Activity
Feb ’26
SwiftUI toolbar items clip DocumentGroup rename affordance
Hi — I’m seeing the DocumentGroup rename/title affordance get clipped on iPad when I populate the navigation bar with SwiftUI toolbar items in .topBarLeading, .principal, and .topBarTrailing (trailing is an HStack of controls). Example: .toolbar { ToolbarItem(placement: .topBarLeading) { UndoRedoControlsView(...) } ToolbarItem(placement: .principal) { Text(canvasInfoTitle).lineLimit(1) } ToolbarItem(placement: .topBarTrailing) { HStack { ... } } } .navigationBarTitleDisplayMode(.inline) Is there a recommended way to structure toolbar content so the system’s document title/rename control always has space (or a way to reserve space / avoid clipping), short of removing .principal or moving items into menus?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
44
Activity
Feb ’26
Vision OS Persona
I’m seeing a camera/capture routing issue on visionOS when multiple WindowGroups are open at the same time. I have a SwiftUI view that starts an AVCaptureSession on onAppear and stops it on onDisappear. The camera feed is displayed in a subview that only exists inside one window. However, when I open additional windows (other WindowGroups) in the same app, the camera perspective/route changes unexpectedly — it looks like the capture is being re-associated with a different scene/window, even though the camera view never moved and no other view starts capture. Expected behavior Opening additional windows should not affect the active capture session or camera routing for the existing camera view. The camera feed should remain stable and tied to the window hosting. Actual behavior When multiple windows are open, the camera feed “switches perspective” / appears to re-route, as if the system changes which scene is considered active for capture. This happens without any explicit code calling startSession()
Replies
0
Boosts
0
Views
66
Activity
Feb ’26
String Catalog Symbols: No Reference-Language Fallback for Partially Translated Locales
I'm having troubles converting my string catalog to symbols because for partly translated languages there is no fallback to the reference language. Let me give you an example. Example Assume an app that supports two languages: English and Japanese. The app is very simple and has only two strings, using symbols in a String Catalog: Key: .helloWorld → “Hello World!” Key: .info → “Information” Case 1: No Japanese translations If I launch the app in Japanese and neither string is translated, English is used as a fallback. The UI shows: “Hello World!” “Information” This is exactly what I would expect. Case 2: Only one string translated Now assume I translate only one string into Japanese: .helloWorld → “こんにちは世界” When I launch the app in Japanese now: .helloWorld correctly shows “こんにちは世界” .info shows info, not “Information” So instead of falling back to English, the key is displayed. This issue does not pop up when I don't use symbols. Because then, my SwiftUI Text elements contain the English ideal text a
Replies
1
Boosts
0
Views
297
Activity
Feb ’26
VideoMaterial Black Screen on Vision Pro Device (Works in Simulator)
VideoMaterial Black Screen on Vision Pro Device (Works in Simulator) App Overview App Name: Extn Browser Bundle ID: ai.extn.browser Purpose: A visionOS web browser that plays 360°/180° VR videos in an immersive sphere environment Development Environment & SDK Versions Component Version Xcode 26.2 Swift 6.2 visionOS Deployment Target 26.2 Swift Concurrency MainActor isolation enabled App is released in the TestFlight. Frameworks Used SwiftUI - UI framework RealityKit - 3D rendering, MeshResource, ModelEntity, VideoMaterial AVFoundation - AVPlayer, AVAudioSession WebKit - WKWebView for browser functionality Network - NWListener for local proxy server Sphere Video Mechanism The app creates an immersive 360° video experience using the following approach: // 1. Create sphere mesh (10 meter radius for immersive viewing) let mesh = MeshResource.generateSphere(radius: 10.0) // 2. Create initial transparent material var material = UnlitMaterial() material.color = .init(tint: .clear) // 3. Create entity an
Replies
0
Boosts
0
Views
332
Activity
Feb ’26
Reply to How to accept CloudKit shares with the new SwiftUI app lifecycle?
CloudKit share acceptance still requires a UIWindowSceneDelegate on iOS. Can try this approach ---- Keep SwiftUI lifecycle @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } Add SceneDelegate import UIKit import CloudKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { func windowScene( _ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith metadata: CKShare.Metadata ) { acceptShare(with: metadata) } } Register it in Info.plist UISceneDelegateClassName = SceneDelegate
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to How to animate `UIHostingController.view` frame when my View's size changes?
@DTS Engineer I am expecting the part on the left, in SwiftUI to animate exactly like the counterpart in UIKit on the right. But they do not; UIKit animation affects both UIView.center and UIView.bounds, and they travel using the same timing curve over the same duration, which makes it seem that the top of the UIKit view is attached to the top of the screen. However, this illusion is not preserved for SwiftUI view because UIHostingController.view.center is not animated; it's teleported to the end position. And I also happen to know that really bounds are not animated either, the UIView actually just fully teleports to the new state, while only the SwiftUI content is animated. And my question is - what is the way to make UIHostingController animate along its SwiftUI content? Can you maybe confirm that there isn't a built-in support for that?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
Accept a Review Rejection Defeat or Play Along with Reviewer
I have a desktop application developed in SwiftUI that shows property locations on the map. That's NOT the main feature. IF you give the application permission to access your location, the blue dot will appear on the map. If you don't, the blue user dot won't appear. That's the only difference with location services. In other words, the application has no use of user's current position beyond showing it on the map. Since it's just the matter of showing or not showing the blue dot on the map, the application doesn't really need to use the location service. Anyway, the reviewer is talking about something else by rejecting the application in two aspects. Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage Guideline 5.1.5 - Legal - Privacy - Location Services As I said earlier, the application only wants to show the blue dot on the map so that you can see your property locations relative to your current location. In code, it's something like the following. Map(position: $propertyViewModel.map
Replies
3
Boosts
0
Views
258
Activity
Feb ’26
Reply to Image not rendering on some devices
Hello @thisisjaymehta, Welcome to SwiftUI development! 🥳 The first thing I would look at is the Attributes menu, located in the Inspector area (the sidebar on the right of Xcode). You can also quickly open this tab by pressing ⌥ ⌘ 4. In that menu you will notice options for devices, appearances, sizes and more. In your screenshot, it appears you have the Scales set to Single Scale. You can try switching this to Individual Scale and add different scales which are configured to show on different devices. You can find more information about how to do that here Fitting images into available space If not, try appearances and see if it's a light/dark mode issue. It looks like you already did some troubleshooting by setting a solid white color background. A great tip you can use to check both color schemes easily is by using this toggle at the bottom of the canvas in Xcode, which will show both the light and dark move preview in Canvas. For more information on Xcodes canvas see Previewing your app’s interf
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to How to animate `UIHostingController.view` frame when my View's size changes?
Hello @isaacweisberg, I see the UIKit example on the right is animating correctly to me. It looks like you followed the steps correctly: Line 75 of ViewController.swift the UIHostingController observes .preferredContentSize. Nice work on implementing that! 😎👍 Can you clarify on what you mean? Are you trying to achieve the same effect in SwiftUI or is the UIKit example on the right not what you were looking for? Let me know,  Travis Trotto - DTS Engineer
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
Reply to Can I disable a SwiftUI View from being a draggable source, but still leave it enabled as a dropDestination?
Sorry for the delay, I didn't get the notification. Thanks for the code, I would recommend to add a link to a focused project where I can download and play with it as of course without the images nor drop targets is hard to see what you are trying to accomplish and will help many developers here figure it out. Customize the drag preview to make the interaction more intuitive. You can modify the draggable modifier .draggable(player, preview: { VStack { Image(jersey) .resizable() .frame(width: 50, height: 50) if let player = content.player { Text(player.last) .font(.caption) } } }) Currently, the drop handler just prints the item. You might want to update the CellContent's player based on the drop? .dropDestination(for: String.self) { items, location in if let firstItem = items.first { print(Dropped: (firstItem)) // Update player logic here if needed // e.g., content.player = updatedPlayerBasedOn(firstItem) } return true } Looking forward to your focused sample. That'll help us better understand what's going on
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
MusicKit + AirPlay
Hello, I'm working on a MusicKit based SwiftUI app. I've integrated AirPlay using the AVRoutePickerView like so: struct UIKitAirPlayPickerView: UIViewRepresentable { func makeUIView(context: Context) -> AVRoutePickerView { let routePickerView = AVRoutePickerView() routePickerView.prioritizesVideoDevices = false return routePickerView } func updateUIView(_ uiView: AVRoutePickerView, context: Context) {} } The AirPlay menu appears as expected, and selecting an AirPlay device functions as expected. I'm currently sending audio from my app to a HomePod. However, the state of the AVRoutePickerView does not reflect the playback state. There is no cover art and it says Not Playing. When my device is locked, my lock screen shows the album art, metadata and AirPlay routing as expected. My app uses the ApplicationMusicPlayer however I encounter the same behavior using the SystemMusicPlayer. Any guidance on how to troubleshoot this? Is there any other way to integrate the system AirPlay picker into my app, or
Replies
1
Boosts
0
Views
573
Activity
Feb ’26