Search results for

“swiftui”

17,235 results found

Post

Replies

Boosts

Views

Activity

SwiftUI ScrollView scrollTo not consistently scrolling to latest message
I am implementing an AI chat application and aiming to achieve ChatGPT-like behavior. Specifically, when a new message is sent, the ScrollView should automatically scroll to the top to display the latest message. I am currently using the scrollTo method for this purpose, but the behavior is inconsistent—sometimes it works as expected, and other times it does not. I’ve noticed that this issue has been reported in multiple places, which suggests it may be a known SwiftUI limitation. I’d like to know: Has this issue been fixed in recent SwiftUI versions, or does it still persist? If it still exists, is there a reliable solution or workaround that anyone can recommend?
3
0
216
Jan ’26
Reply to NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension
I have a SwiftUI app that opens a user-selected audio file (wave). For each audio file, an additional file exists containing events that were extracted from the audio file. This additional file has the same filename and uses the extension bcCalls. I load the audio file using FileImporter view modifier and then access the audio file with a security-scoped bookmark. That works well. To clarify here, do you mean that you’re able to access both the directly selected file and its related sidecar? Or just that you're able to access the direct file? After loading the audio, I create a CallsSidecar NSFilePresenter with the URL of the audio file. I make the presenter known to the NSFileCoordinator and then add it to the FileCoordinator. This fails with NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for; Error Domain=NSPOSIXErrorDomain Code=3 No such process Is the failure here about opening an existing file or about writing a new file? Also, what directory are you working out of? __ Ke
Topic: App & System Services SubTopic: Core OS Tags:
Jan ’26
.glassEffect() renders dark on device but works on simulator - TestFlight doesn't fix it
iOS 26 SwiftUI .glassEffect() renders dark/gray on physical device - TestFlight doesn't fix it .glassEffect() renders as dark/muddy gray on my physical iPhone instead of the light frosted glass like Apple Music's tab bar. What I've confirmed: Same code works perfectly on iOS Simulator Apple Music and other Apple apps show correct Liquid Glass on same device Brand new Xcode project with just .glassEffect() also renders dark TestFlight build (App Store signing) has the SAME problem - still dark/gray This rules out developer signing vs App Store signing as the cause What I've tried: Clean build, delete derived data, reinstall app Completely reinstalled Xcode All accessibility settings correct (Reduce Transparency OFF, Liquid Glass set to Clear) Disabled Metal diagnostics Debug and Release builds Added window configuration for Extended sRGB/P3 color space Added AppDelegate with configureWindowForLiquidGlass() Tried .preferredColorScheme(nil) Tried background animation to force live rendering Environment:
5
0
345
Jan ’26
Horrible weird Window Server killing bug
OS 26.s, Xcode 26.2 TLDR: My pure SwiftUI app freezes the window server, is this a known problem? My app is pure SwiftUI, no low level calls, no networking, no tricksy pointer use. Somehow, something in my code is terminally confusing the Window Server. As in, I run the app, and before I ever seen a window, the Window Server locks up, and is killed by the OS for being unresponsive. Using debugging shows that I get to the end of a Canvas, and it simply freezes upon exiting. I'm about to do the old comment out everything, and bring it back a bit at a time, but I'm wondering if anyone is experiencing this sort of thing? The reaction is so extreme. And it's not Xcode in particular, I built the program with xcodebuild, Xcode itself not running, and ran my app, and it did the same thing.
Topic: UI Frameworks SubTopic: SwiftUI
2
0
100
Jan ’26
Reply to SwiftUI subviews traverse issue
No, I don't think there is a way to find a SwiftUI view via its accessibilityIdentifier. If your intent is to retrieve the frame of a Text and do something based on that in a parent view, GeometryReader + PreferenceKey / anchorPreference will be the way to go, even though it needs some additional code. In iOS 16, onGeometryChange(for:of:action:) allows you to perform an action when a geometry value of a view changes. If you target iOS 16 and later, that may be even easier. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI
Jan ’26
Reply to Errors with PerfPowerTelemetryClientRegistrationService and PPSClientDonation when running iOS application in Xcode
On the workaround front, you’re using MKMapView via UIViewRepresentable. If you switch to the shiny new Map SwiftUI view, does that avoid the problem? Haha I knew you were going to say that. :) Probably, but we still support back to iOS 16 so that's not currently an option. And, since it's just annoying log entries... Another option is to filter these log entries out in Xcode: Thanks for that! I also found the right-click / hide option in the logs that allow the filtering by various categories which definitely helps a lot. As always, thanks so much for your help.
Jan ’26
Reply to Errors with PerfPowerTelemetryClientRegistrationService and PPSClientDonation when running iOS application in Xcode
[quote='873874022, FT-cfoy, /thread/811791?answerId=873874022#873874022, /profile/FT-cfoy'] I wish I could ignore it [/quote] )-; [quote='873870022, FT-cfoy, /thread/811791?answerId=873870022#873870022, /profile/FT-cfoy'] I've submitted a bug report with this FB21768382 [/quote] Thanks. That’s definitely the right choice in this situation. Also, please add a sysdiagnose log to that bug, one taken on your device shortly after reproducing the issue. That helps with the triage. On the workaround front, you’re using MKMapView via UIViewRepresentable. If you switch to the shiny new Map SwiftUI view, does that avoid the problem? Another option is to filter these log entries out in Xcode: Locate the Filter box at the bottom of the Console debug area. Copy the string subsystem:com.apple.PerfPowerServices and paste it into the box. That’ll create a Subsystem filter. In the menu hanging off that filter, select “≠ is not”. For many other systems log hints and tips, see Your Friend the System Log. Share and Enjo
Jan ’26
Reply to Catalyst: determine the device information when running on Mac
[quote='873863022, DTS Engineer, /thread/813853?answerId=873863022#873863022'] may I ask you to file a bug with that project? [/quote] Before you do that, I’d like to clarify what you mean by this: [quote='813853021, OC_s, /thread/813853, /profile/OC_s'] How do I determine the real values? [/quote] What specific information are you looking for here? And what do you plan to do with that information? This matters because Mac Catalyst is returning values that make sense in the iOS-ish environment that’s expected by such apps. It is possible to get ‘real’ values, but the best way to do that depends on your specific setup. For example, the systemName property is uninteresting in a Mac Catalyst app because the real system name is macOS. So you can do this [1]: let systemName: String #if targetEnvironment(macCatalyst) systemName = macOS #else systemName = device.systemName #endif However, that’s just one of these properties. The best path for the other properties varies based your the specific property and your ulti
Topic: App & System Services SubTopic: Core OS Tags:
Jan ’26
Reply to Errors with PerfPowerTelemetryClientRegistrationService and PPSClientDonation when running iOS application in Xcode
Thanks Quinn. This looks to possibly be an internal Apple bug with MKMapView. I can recreate the issue with the following code: import MapKit import SwiftUI struct MyMapkitView: UIViewRepresentable { typealias UIViewType = MKMapView func makeUIView(context: Context) -> MKMapView { return MKMapView() } func updateUIView(_ uiView: MKMapView, context: Context) {} } struct ContentView: View { var body: some View { VStack { MyMapkitView() } .padding() } } Which immediately gives the errors below that match what I'm seeing in my app. I wish I could ignore it, but it quite literally is happening 2-3 times a second so the log is completely buried with these messages. This only started happening when I upgraded Xcode to 26.
Jan ’26
Reply to SwiftUI subviews traverse issue
SwiftUI view hierarchy is internal to the framework. When using SwiftUI, you won't need to traverse the view hierarchy – If you do, I'd say that you probably aren't on the right track... Having said that, I'm quite curious why you need to traverse the view hierarchy in SwiftUI. Would you mind to share? Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI
Jan ’26
NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension
Hi there, I have an SwiftUI app that opens a user selected audio file (wave). For each audio file an additional file exists containing events that were extracted from the audio file. This additional file has the same filename and uses the extension bcCalls. I load the audio file using FileImporter view modifier and within access the audio file with a security scoped bookmark. That works well. After loading the audio I create a CallsSidecar NSFilePresenter with the url of the audio file. I make the presenter known to the NSFileCoordinator and upon this add it to the FileCoordinator. This fails with NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for; Error Domain=NSPOSIXErrorDomain Code=3 No such process My Info.plist contains an entry for the document with NSIsRelatedItemType set to YES I am using this kind of FilePresenter code in various live apps developed some years ago. Now when starting from scratch on a fresh macOS26 system with most current Xcode I do not manage to get
12
0
535
Jan ’26
Reply to How to make fluid TabBar
Hello @Julsalim , You don't need to programmatically hide the TabBar, it can be done by restructuring your Views. Make sure the NavigationStack contains the TabView, and the Tab contains the NavigationLink. Here's an example view structure that achieves what you're looking for: Also, welcome to iOS Development! SwiftUI is my favorite!  Travis Trotto - DTS Engineer NavigationStack { TabView{ Tab(, systemImage: ) { List{ NavigationLink(... }
Topic: UI Frameworks SubTopic: SwiftUI
Jan ’26
How to make fluid TabBar
Hey there guys, I'm new on SwiftUI and iOS Development world. How can I achieve a seamless TabBar transition in SwiftUI? Currently, when I programmatically hide the TabBar on a pushed view and swipe back to the previous view, there is a noticeable delay before the TabBar reappears. How can I make it appear instantly? Here is the link to the video https://streamable.com/3zz2o2 Thank you in advance
Topic: UI Frameworks SubTopic: SwiftUI
2
0
145
Jan ’26
SwiftUI subviews traverse issue
Our project include UIKIt and SwiftUI, and in some case, we need to traverse all subviews, for UIKit implement views, below code: func findView(byIdentifier identifier: String) -> UIView? { if self.accessibilityIdentifier == identifier { return self } for subview in subviews { if let found = subview.findView(byIdentifier: identifier) { return found } } return nil } works well, but for SwiftUI implement views, like below code: struct ContentView: View { var body: some View { VStack { Image(systemName: globe) .imageScale(.large) .foregroundStyle(.tint) .accessibilityIdentifier(Image) Text(Hello, world!) .accessibilityIdentifier(Text) } .padding() } } it can not find subviews in the ContentView, and only a view with type: _UIHostingView> can be found, the Image and Text is not found; And because we have set a accessibilityIdentifier property, so we also try use: @MainActor var accessibilityElements: [Any]? { get set } to find sub node, but this accessibilityElements is not stable, we can
Topic: UI Frameworks SubTopic: SwiftUI
2
0
198
Jan ’26
SwiftUI ScrollView scrollTo not consistently scrolling to latest message
I am implementing an AI chat application and aiming to achieve ChatGPT-like behavior. Specifically, when a new message is sent, the ScrollView should automatically scroll to the top to display the latest message. I am currently using the scrollTo method for this purpose, but the behavior is inconsistent—sometimes it works as expected, and other times it does not. I’ve noticed that this issue has been reported in multiple places, which suggests it may be a known SwiftUI limitation. I’d like to know: Has this issue been fixed in recent SwiftUI versions, or does it still persist? If it still exists, is there a reliable solution or workaround that anyone can recommend?
Replies
3
Boosts
0
Views
216
Activity
Jan ’26
Reply to NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension
I have a SwiftUI app that opens a user-selected audio file (wave). For each audio file, an additional file exists containing events that were extracted from the audio file. This additional file has the same filename and uses the extension bcCalls. I load the audio file using FileImporter view modifier and then access the audio file with a security-scoped bookmark. That works well. To clarify here, do you mean that you’re able to access both the directly selected file and its related sidecar? Or just that you're able to access the direct file? After loading the audio, I create a CallsSidecar NSFilePresenter with the URL of the audio file. I make the presenter known to the NSFileCoordinator and then add it to the FileCoordinator. This fails with NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for; Error Domain=NSPOSIXErrorDomain Code=3 No such process Is the failure here about opening an existing file or about writing a new file? Also, what directory are you working out of? __ Ke
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jan ’26
.glassEffect() renders dark on device but works on simulator - TestFlight doesn't fix it
iOS 26 SwiftUI .glassEffect() renders dark/gray on physical device - TestFlight doesn't fix it .glassEffect() renders as dark/muddy gray on my physical iPhone instead of the light frosted glass like Apple Music's tab bar. What I've confirmed: Same code works perfectly on iOS Simulator Apple Music and other Apple apps show correct Liquid Glass on same device Brand new Xcode project with just .glassEffect() also renders dark TestFlight build (App Store signing) has the SAME problem - still dark/gray This rules out developer signing vs App Store signing as the cause What I've tried: Clean build, delete derived data, reinstall app Completely reinstalled Xcode All accessibility settings correct (Reduce Transparency OFF, Liquid Glass set to Clear) Disabled Metal diagnostics Debug and Release builds Added window configuration for Extended sRGB/P3 color space Added AppDelegate with configureWindowForLiquidGlass() Tried .preferredColorScheme(nil) Tried background animation to force live rendering Environment:
Replies
5
Boosts
0
Views
345
Activity
Jan ’26
Horrible weird Window Server killing bug
OS 26.s, Xcode 26.2 TLDR: My pure SwiftUI app freezes the window server, is this a known problem? My app is pure SwiftUI, no low level calls, no networking, no tricksy pointer use. Somehow, something in my code is terminally confusing the Window Server. As in, I run the app, and before I ever seen a window, the Window Server locks up, and is killed by the OS for being unresponsive. Using debugging shows that I get to the end of a Canvas, and it simply freezes upon exiting. I'm about to do the old comment out everything, and bring it back a bit at a time, but I'm wondering if anyone is experiencing this sort of thing? The reaction is so extreme. And it's not Xcode in particular, I built the program with xcodebuild, Xcode itself not running, and ran my app, and it did the same thing.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
2
Boosts
0
Views
100
Activity
Jan ’26
Reply to SwiftUI subviews traverse issue
No, I don't think there is a way to find a SwiftUI view via its accessibilityIdentifier. If your intent is to retrieve the frame of a Text and do something based on that in a parent view, GeometryReader + PreferenceKey / anchorPreference will be the way to go, even though it needs some additional code. In iOS 16, onGeometryChange(for:of:action:) allows you to perform an action when a geometry value of a view changes. If you target iOS 16 and later, that may be even easier. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jan ’26
Reply to Errors with PerfPowerTelemetryClientRegistrationService and PPSClientDonation when running iOS application in Xcode
On the workaround front, you’re using MKMapView via UIViewRepresentable. If you switch to the shiny new Map SwiftUI view, does that avoid the problem? Haha I knew you were going to say that. :) Probably, but we still support back to iOS 16 so that's not currently an option. And, since it's just annoying log entries... Another option is to filter these log entries out in Xcode: Thanks for that! I also found the right-click / hide option in the logs that allow the filtering by various categories which definitely helps a lot. As always, thanks so much for your help.
Replies
Boosts
Views
Activity
Jan ’26
Reply to Errors with PerfPowerTelemetryClientRegistrationService and PPSClientDonation when running iOS application in Xcode
[quote='873874022, FT-cfoy, /thread/811791?answerId=873874022#873874022, /profile/FT-cfoy'] I wish I could ignore it [/quote] )-; [quote='873870022, FT-cfoy, /thread/811791?answerId=873870022#873870022, /profile/FT-cfoy'] I've submitted a bug report with this FB21768382 [/quote] Thanks. That’s definitely the right choice in this situation. Also, please add a sysdiagnose log to that bug, one taken on your device shortly after reproducing the issue. That helps with the triage. On the workaround front, you’re using MKMapView via UIViewRepresentable. If you switch to the shiny new Map SwiftUI view, does that avoid the problem? Another option is to filter these log entries out in Xcode: Locate the Filter box at the bottom of the Console debug area. Copy the string subsystem:com.apple.PerfPowerServices and paste it into the box. That’ll create a Subsystem filter. In the menu hanging off that filter, select “≠ is not”. For many other systems log hints and tips, see Your Friend the System Log. Share and Enjo
Replies
Boosts
Views
Activity
Jan ’26
Reply to Catalyst: determine the device information when running on Mac
[quote='873863022, DTS Engineer, /thread/813853?answerId=873863022#873863022'] may I ask you to file a bug with that project? [/quote] Before you do that, I’d like to clarify what you mean by this: [quote='813853021, OC_s, /thread/813853, /profile/OC_s'] How do I determine the real values? [/quote] What specific information are you looking for here? And what do you plan to do with that information? This matters because Mac Catalyst is returning values that make sense in the iOS-ish environment that’s expected by such apps. It is possible to get ‘real’ values, but the best way to do that depends on your specific setup. For example, the systemName property is uninteresting in a Mac Catalyst app because the real system name is macOS. So you can do this [1]: let systemName: String #if targetEnvironment(macCatalyst) systemName = macOS #else systemName = device.systemName #endif However, that’s just one of these properties. The best path for the other properties varies based your the specific property and your ulti
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jan ’26
Reply to Errors with PerfPowerTelemetryClientRegistrationService and PPSClientDonation when running iOS application in Xcode
Thanks Quinn. This looks to possibly be an internal Apple bug with MKMapView. I can recreate the issue with the following code: import MapKit import SwiftUI struct MyMapkitView: UIViewRepresentable { typealias UIViewType = MKMapView func makeUIView(context: Context) -> MKMapView { return MKMapView() } func updateUIView(_ uiView: MKMapView, context: Context) {} } struct ContentView: View { var body: some View { VStack { MyMapkitView() } .padding() } } Which immediately gives the errors below that match what I'm seeing in my app. I wish I could ignore it, but it quite literally is happening 2-3 times a second so the log is completely buried with these messages. This only started happening when I upgraded Xcode to 26.
Replies
Boosts
Views
Activity
Jan ’26
Reply to SwiftUI subviews traverse issue
SwiftUI view hierarchy is internal to the framework. When using SwiftUI, you won't need to traverse the view hierarchy – If you do, I'd say that you probably aren't on the right track... Having said that, I'm quite curious why you need to traverse the view hierarchy in SwiftUI. Would you mind to share? Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jan ’26
NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension
Hi there, I have an SwiftUI app that opens a user selected audio file (wave). For each audio file an additional file exists containing events that were extracted from the audio file. This additional file has the same filename and uses the extension bcCalls. I load the audio file using FileImporter view modifier and within access the audio file with a security scoped bookmark. That works well. After loading the audio I create a CallsSidecar NSFilePresenter with the url of the audio file. I make the presenter known to the NSFileCoordinator and upon this add it to the FileCoordinator. This fails with NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for; Error Domain=NSPOSIXErrorDomain Code=3 No such process My Info.plist contains an entry for the document with NSIsRelatedItemType set to YES I am using this kind of FilePresenter code in various live apps developed some years ago. Now when starting from scratch on a fresh macOS26 system with most current Xcode I do not manage to get
Replies
12
Boosts
0
Views
535
Activity
Jan ’26
Reply to How to make fluid TabBar
Hello @Julsalim , You don't need to programmatically hide the TabBar, it can be done by restructuring your Views. Make sure the NavigationStack contains the TabView, and the Tab contains the NavigationLink. Here's an example view structure that achieves what you're looking for: Also, welcome to iOS Development! SwiftUI is my favorite!  Travis Trotto - DTS Engineer NavigationStack { TabView{ Tab(, systemImage: ) { List{ NavigationLink(... }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jan ’26
Reply to tvOS - how to stop OS from backgrounding my app
Solved. An iOS 2.0 feaure that I assume is being set automatically by SwiftUI. [[ UIApplication sharedApplication ] setIdleTimerDisabled:true ];
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jan ’26
How to make fluid TabBar
Hey there guys, I'm new on SwiftUI and iOS Development world. How can I achieve a seamless TabBar transition in SwiftUI? Currently, when I programmatically hide the TabBar on a pushed view and swipe back to the previous view, there is a noticeable delay before the TabBar reappears. How can I make it appear instantly? Here is the link to the video https://streamable.com/3zz2o2 Thank you in advance
Topic: UI Frameworks SubTopic: SwiftUI
Replies
2
Boosts
0
Views
145
Activity
Jan ’26
SwiftUI subviews traverse issue
Our project include UIKIt and SwiftUI, and in some case, we need to traverse all subviews, for UIKit implement views, below code: func findView(byIdentifier identifier: String) -> UIView? { if self.accessibilityIdentifier == identifier { return self } for subview in subviews { if let found = subview.findView(byIdentifier: identifier) { return found } } return nil } works well, but for SwiftUI implement views, like below code: struct ContentView: View { var body: some View { VStack { Image(systemName: globe) .imageScale(.large) .foregroundStyle(.tint) .accessibilityIdentifier(Image) Text(Hello, world!) .accessibilityIdentifier(Text) } .padding() } } it can not find subviews in the ContentView, and only a view with type: _UIHostingView> can be found, the Image and Text is not found; And because we have set a accessibilityIdentifier property, so we also try use: @MainActor var accessibilityElements: [Any]? { get set } to find sub node, but this accessibilityElements is not stable, we can
Topic: UI Frameworks SubTopic: SwiftUI
Replies
2
Boosts
0
Views
198
Activity
Jan ’26