Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

TextField format, integer limits and fractions not applied
Hi Apple-Team, the format of a text field, in my case a percentage with one decimal place, is not applied when a button is pressed and the view is exited using dismiss. It is only used when another field receives focus. A button is not a focusable object, and this is a problem. This allows you to specify more decimal places, resulting in a saved value with unwanted decimal places. It's even worse when you specify integer limits and the value exceeds the limit. Do you always have to check the value before saving it? What's the point of having a format then? Some example images: The items in the list have a fraction limit of 8. The field has integer limit 2 and 1 fraction. When focusing a different field the format is applied. Here the code I used: struct Item: Identifiable, Hashable { var id: Int var value: Double } struct WrongFractionsListView: View { @State private var items: [Item] = [ Item(id: 1, value: 0.225), Item(id: 2, value: 0.377), Item(id: 3, value: 0.241)] enum ItemTransfer: Hashable { case new } var body: some View { List { ForEach(items) { item in HStack { Text("\(item.id)") Spacer() Text("\(item.value, format: .percent.precision(.fractionLength(8)))") } } } .navigationDestination(for: ItemTransfer.self) { _ in WrongFractionsEditorView(items: $items) } .toolbar{ ToolbarItem(placement: .topBarTrailing) { NavigationLink(value: ItemTransfer.new) { Image(systemName: "plus") } } } } } #Preview { NavigationStack { WrongFractionsListView() } } struct WrongFractionsEditorView: View { @Environment(\.dismiss) var dismiss @State private var percentValue: Double = 0 @State private var testValue: String = "" @Binding var items: [Item] var body: some View { Form { TextField("(%)", value: $percentValue, format: .percent.precision(.integerAndFractionLength(integerLimits: 0...2, fractionLimits: 0...1))) .keyboardType(.decimalPad) TextField("Just for Focus", text: $testValue) } .navigationTitle("Percent Fractions") .toolbar{ ToolbarItem(placement: .topBarTrailing) { Button { saveAndClose() } label: { Image(systemName: "checkmark") } } } } private func saveAndClose() { let max = items.max { $0.id < $1.id}!.id let item: Item = .init(id: max+1, value: percentValue) items.append(item) dismiss() } } #Preview { @Previewable @State var items: [Item] = [ Item(id: 1, value: 0.225), Item(id: 2, value: 0.377), Item(id: 3, value: 0.241)] NavigationStack { WrongFractionsEditorView(items: $items) } } How can I fix this? Thank you Christian
2
0
133
1w
MapKit Pitch
I have a navigation app in production that works great. I recently integrated CarPlay, and I'm trying to use a more "horizon view" by increasing the camera pitch during navigation. Specifically, on a CarPlay screen with a resolution of 800×480, I'm trying to use a distance of 1000 m with a pitch of 60°, but MapKit automatically clamps the pitch to a bird's-eye view. If I reduce the distance to 800 m, for example, it works just fine. I'd argue that having a better horizon view during navigation is a safety feature, as users, especially truck drivers, need to see well ahead. Most truck navigation systems provide this by default, so I'm wondering if there's any workaround to achieve this without MapKit clamping the pitch? I found the following in the documentation, which seems pretty clear, but I thought I'd ask if anyone has found a workaround...? From docs: "The class may clamp the value in this property to a maximum value to maintain map readability. There’s no fixed maximum value, though, because the actual maximum value is dependent on the altitude of the camera." MapCamera( centerCoordinate: locationManager.coordinate, distance: 1000, heading: locationManager.heading, pitch: 60 )
0
0
82
1w
Presenting content on Connected Display not working on iOS 27
I have an app that displays different content on a connected display (following this guide). It's working fine on iOS 26 but no longer is working in iOS 27 (both dev betas) + the latest SDKs. I tried to find any update notes but I couldn't find anything so I'm not sure if I'm doing something wrong or if it's an actual bug. I was able to simplify it down to the simplest case here: import SwiftUI // App Delegate to setup the scene delegate @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { print("Calling didFinishLaunchingWithOptions") return true } func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration { print("Calling configurationForConnecting") let sceneConfig = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) sceneConfig.delegateClass = WindowSceneDelegate.self return sceneConfig } } // Scene delegate that sets up the view class WindowSceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) { print("Calling scene(willConnectTo:) with role \(scene.session.role)") guard let windowScene = (scene as? UIWindowScene) else { return } let window = UIWindow(windowScene: windowScene) if scene.session.role == .windowExternalDisplayNonInteractive { window.rootViewController = UIHostingController(rootView: ExternalDisplay()) } else { window.rootViewController = UIHostingController(rootView: ContentView()) } self.window = window window.makeKeyAndVisible() } } struct ExternalDisplay: View { var body: some View { Text("Other World!") } } struct ContentView: View { var body: some View { Text("Hello, world!") } } I also have my Info showing "Enable Multiple Scenes" set to true. I can screen mirror this app to my Mac (same result with an Apple TV). On iOS 26, on my iPhone, I'd see "Hello World!" and on the connected display, I'd see "Other World!". On iOS 27, this is no longer the case. On my connected display, I just see "Hello World". I'm trying to figure out if I've missed something or if this is a dev beta bug.
2
0
176
1w
Crash when selecting a lot of cells in UICollectionView
Hey, I am implementing a "Select All" functionality and experiencing a crash because of running out of memory when having a lot of cells. Calling .selectItem(at:animated:scrollPosition:) on 10k cells need 1.5GB and 20k needs 7GB (crashes on a real device). After selection is completed, memory goes down to normal levels. This broken both on iOS 18.5 and 26.5. Minimal example: https://github.com/martonfarago/collectionViewMemoryTest Is this a know issue? Is there another, maybe more efficient way of selecting all cells? M
Topic: UI Frameworks SubTopic: UIKit
3
0
160
1w
UITabBarAppearance with iOS27 Beta
iOS Version: iOS 27 Beta Xcode: Xcode27 Beta 2 I have a custom UITabBar subclass. The tab bar items are visible and selectable, and the selected state works, but the title color in the normal state is always rendered as white, even though I set a different normal title color. Simplified code let normalColor = UIColor.gray let selectedColor = UIColor.orange let bgColor = UIColor.black let font = UIFont.systemFont(ofSize: 10, weight: .semibold) let appearance = UITabBarAppearance() appearance.configureWithOpaqueBackground() appearance.backgroundEffect = nil appearance.backgroundColor = bgColor appearance.shadowColor = .clear let itemAppearance = appearance.stackedLayoutAppearance itemAppearance.normal.titleTextAttributes = [ .font: font, .foregroundColor: normalColor ] itemAppearance.selected.titleTextAttributes = [ .font: font, .foregroundColor: selectedColor ] itemAppearance.normal.iconColor = normalColor itemAppearance.selected.iconColor = selectedColor appearance.stackedLayoutAppearance = itemAppearance appearance.inlineLayoutAppearance = itemAppearance appearance.compactInlineLayoutAppearance = itemAppearance tabBar.standardAppearance = appearance if #available(iOS 15.0, *) { tabBar.scrollEdgeAppearance = appearance } tabBar.backgroundColor = bgColor tabBar.isTranslucent = false The problem: The selected title/icon color works. The normal title color is ignored and stays white. This happens after moving to the newer tab bar appearance behavior / Liquid Glass environment. Question: Is there any additional configuration required for UITabBarAppearance so that the normal UITabBarItem title color is respected? Could unselectedItemTintColor, tintColor, scrollEdgeAppearance, or Liquid Glass behavior override normal.titleTextAttributes?
3
0
165
1w
NSApp.activate() does not work with menu bar (background) apps
NSApp(ignoringOtherApps:) is deprecated but there is no other working alternative for menu bar apps. NSApp.activate() does not work when no app windows are active and we want to show a window from a menu bar application. Making it impossible for the app to open a window and make it active. Is it really an intended behavior? Here is a sample project showing the issue: https://github.com/wojciech-kulik/macos-menu-bar-bug Steps to reproduce: Run the app. Focus some other app like Finder or Safari. Click on the app's menu bar icon and select "Open". The app window will appear below the other app's window, instead of being brought to the front. NSApp(ignoringOtherApps: true) works as expected though. I also created a feedback ticket: FB23508310
10
1
209
2w
Why does SwiftUI not come with an Environment entry for the current NavigationPath?
If I have a detail view, it can include a NavigationLink (with either a specific destination view, or a value to be resolved by the nearest .navigationDestination handler in to a view). But some operations cannot be captured by a NavigationLink. For example, perhaps this detail view is editing a list, and I have a button to insert a new item. I may wish to insert the new item, and then navigate to a further editor for the inserted item. I can't do that with a NavigationLink: NavigationLink { // 🚨 This is a @ViewBuilder/@ContentBuilder, and there are no guarantees about how often it is invoked. let newItem = dataSource.insertNewItem() ItemEditor(newItem) } label: { // ... } This is the use-case which NavigationPath or typed navigation stacks handle for us: Button { let newItem = dataSource.insertNewItem() navigationPath.append(newItem) } label: { // ... } .navigationDestination(for: Item.self) { item in ItemEditor(item) } Unfortunately, while NavigationLink is able to inspect the View's environment, find the nearest NavigationStack, and push to it, there is no built-in @Environment key for programmatic navigation to do the same. Instead, developers need to add the path as an explicit state variable where the stack is declared, and manually pass it around or create their own @Environment keys, being diligent to ensure they always set that environment value in case some detail view happens to need to need programmatic navigation. I've never understood why. This seems to be a common problem in the ecosystem, and of course in UIKit you can always grab the nearest .navigationController, so I always thought it was an intentional omission. Was it? Should I file an enhancement request? Or is there a reason why this is not considered a good idea? Thanks
Topic: UI Frameworks SubTopic: SwiftUI
0
0
95
2w
SwiftUI 6 AttributeGraph warnings in console
On a MacBook Air M4 running macOS Sequoia 15.7.7, the following tiny code does warn inside the Xcode 26.3. Here is the whole console output: === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 110216 === === AttributeGraph: cycle detected through attribute 110216 === === AttributeGraph: cycle detected through attribute 110284 === === AttributeGraph: cycle detected through attribute 110284 === === AttributeGraph: cycle detected through attribute 110216 === === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 110216 === Here is the full code: import SwiftUI @main struct myApp: App { var body: some Scene { WindowGroup { BaseView() } } } struct BaseView: View { @State private var isWorking: Bool = false var body: some View { Button("Go") { Task { // AttributeGraph warnings await MainActor.run { isWorking = true } await MainActor.run { isWorking = false } // No warnings at all // DispatchQueue.main.async { isWorking = true } // DispatchQueue.main.async { isWorking = false } } } .disabled(isWorking) .padding() } } You can see with DispatchQueue.main.async {...}, warnings aren't there. After a few days struggling with different AI support (Claude, ChatGPT, Perplexity), I didn't find any way to fix my own code. This tiny code is just there to show the issue. I tested multiple workarounds without finding one that fits to my app context. Thanks in advance for your support.
Topic: UI Frameworks SubTopic: SwiftUI
4
0
165
2w
App crashing on macOS 27
My app is now crashing when clicking on the tray icon with macOS 27 when it worked just fine with previous releases. I've submitted a feedback issue, FB23457330, but was curious if this should be something I should be looking into. Thread backtrace is Thread 9 Crashed:: Dispatch queue: com.apple.root.utility-qos.cooperative 0 libsystem_kernel.dylib 0x18539a654 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1853d6970 pthread_kill + 296 2 libsystem_c.dylib 0x1852d8b4c abort + 148 3 libc++abi.dylib 0x18538d2ec __abort_message + 132 4 libc++abi.dylib 0x18537a640 demangling_terminate_handler() + 296 5 libobjc.A.dylib 0x184f6e3cc _objc_terminate() + 156 6 libc++abi.dylib 0x18538a288 std::__terminate(void (*)()) + 16 7 libc++abi.dylib 0x18538c79c __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 88 8 libc++abi.dylib 0x18537918c __cxa_throw + 92 9 libobjc.A.dylib 0x184f648f0 objc_exception_throw + 448 10 Foundation 0x186c6e858 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 288 11 AppKit 0x1899a6cfc -[NSMenu itemArray] + 32 12 AppKit 0x18a0987fc -[NSMenu _campoItem] + 24 13 AppKit 0x18a09831c -[NSMenu _assistantFieldIsEffectivelyVisible] + 24 14 AppKit 0x18a09d970 -[NSMenu _effectiveTypingBehavior] + 60 15 AppKit 0x189f1a7d0 -[NSContextMenuImpl _targetWidth] + 164 16 AppKit 0x189f1afe4 -[NSContextMenuImpl _commitWindowSizeChangesForWidth:height:animated:] + 96 17 AppKit 0x189f21880 -[NSContextMenuImpl _updateSizeEstimateForItemAtIndex:includingHeight:] + 1556 18 AppKit 0x189f1f8dc -[NSContextMenuImpl _menuItem:atIndex:didChangeTitleFrom:to:] + 260 19 AppKit 0x1899acf38 -[NSMenu _menuItem:didChangeTitleFrom:to:] + 124 20 AppKit 0x1899a9cb4 -[NSMenuItem setTitle:] + 160 21 NCXClient 0x100061438 0x100018000 + 300088 22 NCXClient 0x10006bc95 0x100018000 + 343189 23 NCXClient 0x10003c909 0x100018000 + 149769 24 NCXClient 0x10004d3b9 0x100018000 + 218041 25 NCXClient 0x10003c909 0x100018000 + 149769 26 libswift_Concurrency.dylib 0x2acf59d41 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1
Topic: UI Frameworks SubTopic: AppKit
3
0
187
2w
Clarification on the planned removal of UIDesignRequiresCompatibility
Dear Apple Developer Support, I am developing and maintaining an iOS application. In iOS 26, we understand that setting UIDesignRequiresCompatibility to true in the Info.plist file allows an app to opt out of the Liquid Glass design. However, we also understand that during WWDC25 Platforms State of the Union, Apple stated: "We intend this option to be removed in the next major release." We would appreciate clarification on the following points. Questions Should the phrase "next major release" be interpreted as iOS 27? Is it currently Apple's plan to make UIDesignRequiresCompatibility unavailable or remove it in iOS 27? Or is the statement above only an intended direction, with the actual removal schedule still subject to change? If there is any publicly shareable information regarding the future availability or deprecation timeline of UIDesignRequiresCompatibility, could you please provide it? Background We develop and maintain a business application that contains a large number of custom screens and UI components. Adapting the entire application to the Liquid Glass design system will require significant design review, implementation effort, and testing. As a result, the future availability of UIDesignRequiresCompatibility is a critical factor in our development planning and resource allocation. For this reason, we would greatly appreciate any guidance you can provide regarding Apple's current plans for this compatibility option. Thank you for your time and assistance. Best regards, Toshiyuki
10
0
697
2w
Tap area of a button differs whether it is in toolbar or not
To compare the tap areas of two similar buttons, the sample below is run in the preview canvas for an iPhone with iOS 26. Button 1 is outside the toolbar, whereas Button 2 is inside the toolbar. When tapping outside Button 1 near its edge, unexpectedly the action is triggered. When tapping inside Button 2 near its edge, unexpectedly the action is not triggered. Why are the tap areas of similar buttons not similar ? How to make a tap area have the edge of the button ? . . import SwiftUI struct SampleView: View { var body: some View { NavigationStack { Button(action: self.action) { Text("Button 1") } .buttonStyle(.glassProminent) .toolbar { ToolbarItem { Button(action: self.action) { Text("Button 2") } .buttonStyle(.glassProminent) } } } } private func action() { print("Action Triggered !") } } #Preview { SampleView() }
0
0
88
2w
Labels in toolbar menu get wrapped when upgrading from iOS 18 to 26
When upgrading an app from iOS 18 to iOS 26, some labels in a toolbar menu get wrapped unexpectedly. The issue can be reproduced through the sample below, which contains this label : "Envoyer une réaction" On iPhone with iOS 18, the label is displayed on 1 line. But on iPhone with iOS 26, the label is displayed on 2 lines. No improvement was obtained through these modifiers : .lineLimit, .frame and .fixedSize . . How to avoid this unnecessary label wrapping that disrupts the readability ? . . import SwiftUI struct SampleView: View { var body: some View { NavigationStack { Color.clear .toolbar { ToolbarItem { Menu { Button(action: {}) { Label("Envoyer une réaction", systemImage: "envelope") } } label: { Image(systemName: "ellipsis") } } } } } } #Preview { SampleView() }
2
0
140
2w
PHPickerViewController: UI rendering failure and data retrieval errors on iOS 17 & 26.4
Description: I am encountering critical issues with PHPickerViewController using the "Zero-Permission" configuration. The behavior differs significantly between iOS 17 and iOS 26.4, but both prevent successful image selection. Observed Behaviors: On iOS 26.4 (iPhone 17 Pro Max): The PHPicker UI fails to render the photo grid entirely. Upon initialization, the system UI displays an "Unable to load photo" alert, preventing users from even viewing or selecting images. On iOS 17: The picker UI loads, but after the user selects an image and adds it, the subsequent itemProvider.loadObject call consistently fails, returning an error and preventing our app from retrieving the image data. Current Implementation: var config = PHPickerConfiguration() config.filter = .images config.selectionLimit = pickLimit // Problematic logic: if ABTestManager.shared.isPHPickerCurrent { config.preferredAssetRepresentationMode = .current } let pickerVC = PHPickerViewController(configuration: config) pickerVC.delegate = self user device Images: What I have tested: I have been using preferredAssetRepresentationMode = .current in my AB tests. I have not yet tested .compatible mode, as my application logic requires access to high-fidelity assets. However, the current behavior suggests a regression or a fundamental incompatibility with how the system handles image containers for high-end hardware (e.g., iPhone 17 Pro Max) in the out-of-process picker. Supporting Documentation: Minimal Reproducible Project: [Attached] Logs: [Attached sysdiagnose logs] My Questions: Is the "Unable to load photo" UI failure on iOS 26.4 a known limitation for certain high-resolution asset types when using .current mode? Are there specific handling requirements for NSItemProvider when the system fails to resolve the image data in .current mode on older iOS 17 devices? Given that these failures occur in a "Zero-Permission" context, are there specific metadata or image processing constraints I should be aware of to prevent the picker from entering a "failed" state?
2
1
204
2w
onChange(of:initial:_:) changes when same value assigned
Overview When calling onChange(of:initial:_:) with initial as true, closure called even when the value assigned is the same as previous value (not just the first time, subsequently too). However when initial value is false it is called only when value changes. Questions Is this a bug? Am I missing something?
Replies
1
Boosts
0
Views
195
Activity
1w
TextField format, integer limits and fractions not applied
Hi Apple-Team, the format of a text field, in my case a percentage with one decimal place, is not applied when a button is pressed and the view is exited using dismiss. It is only used when another field receives focus. A button is not a focusable object, and this is a problem. This allows you to specify more decimal places, resulting in a saved value with unwanted decimal places. It's even worse when you specify integer limits and the value exceeds the limit. Do you always have to check the value before saving it? What's the point of having a format then? Some example images: The items in the list have a fraction limit of 8. The field has integer limit 2 and 1 fraction. When focusing a different field the format is applied. Here the code I used: struct Item: Identifiable, Hashable { var id: Int var value: Double } struct WrongFractionsListView: View { @State private var items: [Item] = [ Item(id: 1, value: 0.225), Item(id: 2, value: 0.377), Item(id: 3, value: 0.241)] enum ItemTransfer: Hashable { case new } var body: some View { List { ForEach(items) { item in HStack { Text("\(item.id)") Spacer() Text("\(item.value, format: .percent.precision(.fractionLength(8)))") } } } .navigationDestination(for: ItemTransfer.self) { _ in WrongFractionsEditorView(items: $items) } .toolbar{ ToolbarItem(placement: .topBarTrailing) { NavigationLink(value: ItemTransfer.new) { Image(systemName: "plus") } } } } } #Preview { NavigationStack { WrongFractionsListView() } } struct WrongFractionsEditorView: View { @Environment(\.dismiss) var dismiss @State private var percentValue: Double = 0 @State private var testValue: String = "" @Binding var items: [Item] var body: some View { Form { TextField("(%)", value: $percentValue, format: .percent.precision(.integerAndFractionLength(integerLimits: 0...2, fractionLimits: 0...1))) .keyboardType(.decimalPad) TextField("Just for Focus", text: $testValue) } .navigationTitle("Percent Fractions") .toolbar{ ToolbarItem(placement: .topBarTrailing) { Button { saveAndClose() } label: { Image(systemName: "checkmark") } } } } private func saveAndClose() { let max = items.max { $0.id < $1.id}!.id let item: Item = .init(id: max+1, value: percentValue) items.append(item) dismiss() } } #Preview { @Previewable @State var items: [Item] = [ Item(id: 1, value: 0.225), Item(id: 2, value: 0.377), Item(id: 3, value: 0.241)] NavigationStack { WrongFractionsEditorView(items: $items) } } How can I fix this? Thank you Christian
Replies
2
Boosts
0
Views
133
Activity
1w
Does SwiftUI pass views via the preference and environment, if so, how?
I am under the assumption that SwiftUI does pass views via preference atleast (navigationDestination, toolbar, sheet, alerts, popover etc.,). How does it maintain view identity and does it wrap the passing view in AnyView or internally it uses type inference magic, that is not available to us?. If it does not, then how does it pass them instead ?
Replies
0
Boosts
0
Views
78
Activity
1w
MapKit Pitch
I have a navigation app in production that works great. I recently integrated CarPlay, and I'm trying to use a more "horizon view" by increasing the camera pitch during navigation. Specifically, on a CarPlay screen with a resolution of 800×480, I'm trying to use a distance of 1000 m with a pitch of 60°, but MapKit automatically clamps the pitch to a bird's-eye view. If I reduce the distance to 800 m, for example, it works just fine. I'd argue that having a better horizon view during navigation is a safety feature, as users, especially truck drivers, need to see well ahead. Most truck navigation systems provide this by default, so I'm wondering if there's any workaround to achieve this without MapKit clamping the pitch? I found the following in the documentation, which seems pretty clear, but I thought I'd ask if anyone has found a workaround...? From docs: "The class may clamp the value in this property to a maximum value to maintain map readability. There’s no fixed maximum value, though, because the actual maximum value is dependent on the altitude of the camera." MapCamera( centerCoordinate: locationManager.coordinate, distance: 1000, heading: locationManager.heading, pitch: 60 )
Replies
0
Boosts
0
Views
82
Activity
1w
Presenting content on Connected Display not working on iOS 27
I have an app that displays different content on a connected display (following this guide). It's working fine on iOS 26 but no longer is working in iOS 27 (both dev betas) + the latest SDKs. I tried to find any update notes but I couldn't find anything so I'm not sure if I'm doing something wrong or if it's an actual bug. I was able to simplify it down to the simplest case here: import SwiftUI // App Delegate to setup the scene delegate @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { print("Calling didFinishLaunchingWithOptions") return true } func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration { print("Calling configurationForConnecting") let sceneConfig = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) sceneConfig.delegateClass = WindowSceneDelegate.self return sceneConfig } } // Scene delegate that sets up the view class WindowSceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo _: UISceneSession, options _: UIScene.ConnectionOptions) { print("Calling scene(willConnectTo:) with role \(scene.session.role)") guard let windowScene = (scene as? UIWindowScene) else { return } let window = UIWindow(windowScene: windowScene) if scene.session.role == .windowExternalDisplayNonInteractive { window.rootViewController = UIHostingController(rootView: ExternalDisplay()) } else { window.rootViewController = UIHostingController(rootView: ContentView()) } self.window = window window.makeKeyAndVisible() } } struct ExternalDisplay: View { var body: some View { Text("Other World!") } } struct ContentView: View { var body: some View { Text("Hello, world!") } } I also have my Info showing "Enable Multiple Scenes" set to true. I can screen mirror this app to my Mac (same result with an Apple TV). On iOS 26, on my iPhone, I'd see "Hello World!" and on the connected display, I'd see "Other World!". On iOS 27, this is no longer the case. On my connected display, I just see "Hello World". I'm trying to figure out if I've missed something or if this is a dev beta bug.
Replies
2
Boosts
0
Views
176
Activity
1w
Crash when selecting a lot of cells in UICollectionView
Hey, I am implementing a "Select All" functionality and experiencing a crash because of running out of memory when having a lot of cells. Calling .selectItem(at:animated:scrollPosition:) on 10k cells need 1.5GB and 20k needs 7GB (crashes on a real device). After selection is completed, memory goes down to normal levels. This broken both on iOS 18.5 and 26.5. Minimal example: https://github.com/martonfarago/collectionViewMemoryTest Is this a know issue? Is there another, maybe more efficient way of selecting all cells? M
Topic: UI Frameworks SubTopic: UIKit
Replies
3
Boosts
0
Views
160
Activity
1w
UITabBarAppearance with iOS27 Beta
iOS Version: iOS 27 Beta Xcode: Xcode27 Beta 2 I have a custom UITabBar subclass. The tab bar items are visible and selectable, and the selected state works, but the title color in the normal state is always rendered as white, even though I set a different normal title color. Simplified code let normalColor = UIColor.gray let selectedColor = UIColor.orange let bgColor = UIColor.black let font = UIFont.systemFont(ofSize: 10, weight: .semibold) let appearance = UITabBarAppearance() appearance.configureWithOpaqueBackground() appearance.backgroundEffect = nil appearance.backgroundColor = bgColor appearance.shadowColor = .clear let itemAppearance = appearance.stackedLayoutAppearance itemAppearance.normal.titleTextAttributes = [ .font: font, .foregroundColor: normalColor ] itemAppearance.selected.titleTextAttributes = [ .font: font, .foregroundColor: selectedColor ] itemAppearance.normal.iconColor = normalColor itemAppearance.selected.iconColor = selectedColor appearance.stackedLayoutAppearance = itemAppearance appearance.inlineLayoutAppearance = itemAppearance appearance.compactInlineLayoutAppearance = itemAppearance tabBar.standardAppearance = appearance if #available(iOS 15.0, *) { tabBar.scrollEdgeAppearance = appearance } tabBar.backgroundColor = bgColor tabBar.isTranslucent = false The problem: The selected title/icon color works. The normal title color is ignored and stays white. This happens after moving to the newer tab bar appearance behavior / Liquid Glass environment. Question: Is there any additional configuration required for UITabBarAppearance so that the normal UITabBarItem title color is respected? Could unselectedItemTintColor, tintColor, scrollEdgeAppearance, or Liquid Glass behavior override normal.titleTextAttributes?
Replies
3
Boosts
0
Views
165
Activity
1w
UISceneDelegate migration - firm deadline?
I have not yet completed the migration to scene delegate. If I still build with Xcode 26, will my app continue to launch on iOS 27 even if I release updates (still built with Xcode 26) after the iOS 27 release?
Topic: UI Frameworks SubTopic: UIKit
Replies
4
Boosts
0
Views
355
Activity
1w
NSApp.activate() does not work with menu bar (background) apps
NSApp(ignoringOtherApps:) is deprecated but there is no other working alternative for menu bar apps. NSApp.activate() does not work when no app windows are active and we want to show a window from a menu bar application. Making it impossible for the app to open a window and make it active. Is it really an intended behavior? Here is a sample project showing the issue: https://github.com/wojciech-kulik/macos-menu-bar-bug Steps to reproduce: Run the app. Focus some other app like Finder or Safari. Click on the app's menu bar icon and select "Open". The app window will appear below the other app's window, instead of being brought to the front. NSApp(ignoringOtherApps: true) works as expected though. I also created a feedback ticket: FB23508310
Replies
10
Boosts
1
Views
209
Activity
2w
Why does SwiftUI not come with an Environment entry for the current NavigationPath?
If I have a detail view, it can include a NavigationLink (with either a specific destination view, or a value to be resolved by the nearest .navigationDestination handler in to a view). But some operations cannot be captured by a NavigationLink. For example, perhaps this detail view is editing a list, and I have a button to insert a new item. I may wish to insert the new item, and then navigate to a further editor for the inserted item. I can't do that with a NavigationLink: NavigationLink { // 🚨 This is a @ViewBuilder/@ContentBuilder, and there are no guarantees about how often it is invoked. let newItem = dataSource.insertNewItem() ItemEditor(newItem) } label: { // ... } This is the use-case which NavigationPath or typed navigation stacks handle for us: Button { let newItem = dataSource.insertNewItem() navigationPath.append(newItem) } label: { // ... } .navigationDestination(for: Item.self) { item in ItemEditor(item) } Unfortunately, while NavigationLink is able to inspect the View's environment, find the nearest NavigationStack, and push to it, there is no built-in @Environment key for programmatic navigation to do the same. Instead, developers need to add the path as an explicit state variable where the stack is declared, and manually pass it around or create their own @Environment keys, being diligent to ensure they always set that environment value in case some detail view happens to need to need programmatic navigation. I've never understood why. This seems to be a common problem in the ecosystem, and of course in UIKit you can always grab the nearest .navigationController, so I always thought it was an intentional omission. Was it? Should I file an enhancement request? Or is there a reason why this is not considered a good idea? Thanks
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
95
Activity
2w
SwiftUI 6 AttributeGraph warnings in console
On a MacBook Air M4 running macOS Sequoia 15.7.7, the following tiny code does warn inside the Xcode 26.3. Here is the whole console output: === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 110216 === === AttributeGraph: cycle detected through attribute 110216 === === AttributeGraph: cycle detected through attribute 110284 === === AttributeGraph: cycle detected through attribute 110284 === === AttributeGraph: cycle detected through attribute 110216 === === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 109592 === === AttributeGraph: cycle detected through attribute 110216 === Here is the full code: import SwiftUI @main struct myApp: App { var body: some Scene { WindowGroup { BaseView() } } } struct BaseView: View { @State private var isWorking: Bool = false var body: some View { Button("Go") { Task { // AttributeGraph warnings await MainActor.run { isWorking = true } await MainActor.run { isWorking = false } // No warnings at all // DispatchQueue.main.async { isWorking = true } // DispatchQueue.main.async { isWorking = false } } } .disabled(isWorking) .padding() } } You can see with DispatchQueue.main.async {...}, warnings aren't there. After a few days struggling with different AI support (Claude, ChatGPT, Perplexity), I didn't find any way to fix my own code. This tiny code is just there to show the issue. I tested multiple workarounds without finding one that fits to my app context. Thanks in advance for your support.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
4
Boosts
0
Views
165
Activity
2w
App crashing on macOS 27
My app is now crashing when clicking on the tray icon with macOS 27 when it worked just fine with previous releases. I've submitted a feedback issue, FB23457330, but was curious if this should be something I should be looking into. Thread backtrace is Thread 9 Crashed:: Dispatch queue: com.apple.root.utility-qos.cooperative 0 libsystem_kernel.dylib 0x18539a654 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1853d6970 pthread_kill + 296 2 libsystem_c.dylib 0x1852d8b4c abort + 148 3 libc++abi.dylib 0x18538d2ec __abort_message + 132 4 libc++abi.dylib 0x18537a640 demangling_terminate_handler() + 296 5 libobjc.A.dylib 0x184f6e3cc _objc_terminate() + 156 6 libc++abi.dylib 0x18538a288 std::__terminate(void (*)()) + 16 7 libc++abi.dylib 0x18538c79c __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 88 8 libc++abi.dylib 0x18537918c __cxa_throw + 92 9 libobjc.A.dylib 0x184f648f0 objc_exception_throw + 448 10 Foundation 0x186c6e858 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 288 11 AppKit 0x1899a6cfc -[NSMenu itemArray] + 32 12 AppKit 0x18a0987fc -[NSMenu _campoItem] + 24 13 AppKit 0x18a09831c -[NSMenu _assistantFieldIsEffectivelyVisible] + 24 14 AppKit 0x18a09d970 -[NSMenu _effectiveTypingBehavior] + 60 15 AppKit 0x189f1a7d0 -[NSContextMenuImpl _targetWidth] + 164 16 AppKit 0x189f1afe4 -[NSContextMenuImpl _commitWindowSizeChangesForWidth:height:animated:] + 96 17 AppKit 0x189f21880 -[NSContextMenuImpl _updateSizeEstimateForItemAtIndex:includingHeight:] + 1556 18 AppKit 0x189f1f8dc -[NSContextMenuImpl _menuItem:atIndex:didChangeTitleFrom:to:] + 260 19 AppKit 0x1899acf38 -[NSMenu _menuItem:didChangeTitleFrom:to:] + 124 20 AppKit 0x1899a9cb4 -[NSMenuItem setTitle:] + 160 21 NCXClient 0x100061438 0x100018000 + 300088 22 NCXClient 0x10006bc95 0x100018000 + 343189 23 NCXClient 0x10003c909 0x100018000 + 149769 24 NCXClient 0x10004d3b9 0x100018000 + 218041 25 NCXClient 0x10003c909 0x100018000 + 149769 26 libswift_Concurrency.dylib 0x2acf59d41 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1
Topic: UI Frameworks SubTopic: AppKit
Replies
3
Boosts
0
Views
187
Activity
2w
Clarification on the planned removal of UIDesignRequiresCompatibility
Dear Apple Developer Support, I am developing and maintaining an iOS application. In iOS 26, we understand that setting UIDesignRequiresCompatibility to true in the Info.plist file allows an app to opt out of the Liquid Glass design. However, we also understand that during WWDC25 Platforms State of the Union, Apple stated: "We intend this option to be removed in the next major release." We would appreciate clarification on the following points. Questions Should the phrase "next major release" be interpreted as iOS 27? Is it currently Apple's plan to make UIDesignRequiresCompatibility unavailable or remove it in iOS 27? Or is the statement above only an intended direction, with the actual removal schedule still subject to change? If there is any publicly shareable information regarding the future availability or deprecation timeline of UIDesignRequiresCompatibility, could you please provide it? Background We develop and maintain a business application that contains a large number of custom screens and UI components. Adapting the entire application to the Liquid Glass design system will require significant design review, implementation effort, and testing. As a result, the future availability of UIDesignRequiresCompatibility is a critical factor in our development planning and resource allocation. For this reason, we would greatly appreciate any guidance you can provide regarding Apple's current plans for this compatibility option. Thank you for your time and assistance. Best regards, Toshiyuki
Replies
10
Boosts
0
Views
697
Activity
2w
How to change the color of the native back button
How do I change the color of the native back button that is added automatically with NavigationSplitView? I have tried a lot of different methods, but I can't find out how to change its color to a custom color instead of just black.
Replies
0
Boosts
0
Views
110
Activity
2w
Tap area of a button differs whether it is in toolbar or not
To compare the tap areas of two similar buttons, the sample below is run in the preview canvas for an iPhone with iOS 26. Button 1 is outside the toolbar, whereas Button 2 is inside the toolbar. When tapping outside Button 1 near its edge, unexpectedly the action is triggered. When tapping inside Button 2 near its edge, unexpectedly the action is not triggered. Why are the tap areas of similar buttons not similar ? How to make a tap area have the edge of the button ? . . import SwiftUI struct SampleView: View { var body: some View { NavigationStack { Button(action: self.action) { Text("Button 1") } .buttonStyle(.glassProminent) .toolbar { ToolbarItem { Button(action: self.action) { Text("Button 2") } .buttonStyle(.glassProminent) } } } } private func action() { print("Action Triggered !") } } #Preview { SampleView() }
Replies
0
Boosts
0
Views
88
Activity
2w
swipeaction background color
With the new .swipeActions introduced in WWDC26, is there any way to give those buttons a background color? I don't mean tinting the button. But the background they appear on.
Replies
0
Boosts
0
Views
74
Activity
2w
Having trouble making swipe actions work on list items when the list is inside a horizontal ScrollView
I have a list that's inside a horizontal scroll view: horizontal scroll view list list row list row list row list list row list row list row list list row list row list row When I add swipe actions on list rows and try to use the app, the scroll view scrolls instead. does anyone a solution to this?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
82
Activity
2w
Transitions inside ScreenTime Report is not working if phone locked when app is opened.
Transitions inside ScreenTime Report is not working if phone locked when app is opened. It is starts working only after terminate and open the app.
Replies
1
Boosts
0
Views
112
Activity
2w
Labels in toolbar menu get wrapped when upgrading from iOS 18 to 26
When upgrading an app from iOS 18 to iOS 26, some labels in a toolbar menu get wrapped unexpectedly. The issue can be reproduced through the sample below, which contains this label : "Envoyer une réaction" On iPhone with iOS 18, the label is displayed on 1 line. But on iPhone with iOS 26, the label is displayed on 2 lines. No improvement was obtained through these modifiers : .lineLimit, .frame and .fixedSize . . How to avoid this unnecessary label wrapping that disrupts the readability ? . . import SwiftUI struct SampleView: View { var body: some View { NavigationStack { Color.clear .toolbar { ToolbarItem { Menu { Button(action: {}) { Label("Envoyer une réaction", systemImage: "envelope") } } label: { Image(systemName: "ellipsis") } } } } } } #Preview { SampleView() }
Replies
2
Boosts
0
Views
140
Activity
2w
PHPickerViewController: UI rendering failure and data retrieval errors on iOS 17 & 26.4
Description: I am encountering critical issues with PHPickerViewController using the "Zero-Permission" configuration. The behavior differs significantly between iOS 17 and iOS 26.4, but both prevent successful image selection. Observed Behaviors: On iOS 26.4 (iPhone 17 Pro Max): The PHPicker UI fails to render the photo grid entirely. Upon initialization, the system UI displays an "Unable to load photo" alert, preventing users from even viewing or selecting images. On iOS 17: The picker UI loads, but after the user selects an image and adds it, the subsequent itemProvider.loadObject call consistently fails, returning an error and preventing our app from retrieving the image data. Current Implementation: var config = PHPickerConfiguration() config.filter = .images config.selectionLimit = pickLimit // Problematic logic: if ABTestManager.shared.isPHPickerCurrent { config.preferredAssetRepresentationMode = .current } let pickerVC = PHPickerViewController(configuration: config) pickerVC.delegate = self user device Images: What I have tested: I have been using preferredAssetRepresentationMode = .current in my AB tests. I have not yet tested .compatible mode, as my application logic requires access to high-fidelity assets. However, the current behavior suggests a regression or a fundamental incompatibility with how the system handles image containers for high-end hardware (e.g., iPhone 17 Pro Max) in the out-of-process picker. Supporting Documentation: Minimal Reproducible Project: [Attached] Logs: [Attached sysdiagnose logs] My Questions: Is the "Unable to load photo" UI failure on iOS 26.4 a known limitation for certain high-resolution asset types when using .current mode? Are there specific handling requirements for NSItemProvider when the system fails to resolve the image data in .current mode on older iOS 17 devices? Given that these failures occur in a "Zero-Permission" context, are there specific metadata or image processing constraints I should be aware of to prevent the picker from entering a "failed" state?
Replies
2
Boosts
1
Views
204
Activity
2w