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

A Summary of the iPhone Duo Group Lab
Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the iPhone Duo Group Labs: How should apps preserve navigation and UI state when switching between the inner and outer displays? Treat display transitions as size-class and trait changes, not a scene disconnect or app termination; your process stays alive. For more information, see Prepare your app for iPhone Duo. For state that must survive a scene disconnect/reconnect, implement stateRestorationActivity(for:) to save an NSUserActivity Restoring your app's state. Do multiple instances of the same app on iPhone Duo share UserDefaults/@AppStorage state? Multiple instances of your app's UI on iPhone Duo behave similarly to multi-window support on iPadOS. To learn more, see Leverage multiple displays and scenes on iPhone Duo. Both UserDefaults and AppStorage are app-wide, not per-window, stores. If a full-screen app on the inner display is closed, does it move to the outer display or get backgrounded? iPhone Duo honors UIRequiresFullScreen and apps adapt in place as the device opens and closes rather than backgrounding. To learn more, watch Prepare your app for iPhone Duo. How should apps preserve state — text input, scroll position, video playback, camera sessions — during hinge angle transitions? For example, when a LazyVGrid's column count changes because the device folds, does SwiftUI preserve scroll position automatically, or should you use scrollPosition(id:)? The system generally preserves text input and scroll position automatically since hinge angle changes are represented as size-class and trait updates, not a scene disconnect or app termination. This applies even to cases like a LazyVGrid column-count change triggered by opening or closing the device — apps typically don't need to manually manage scroll position with scrollPosition(id:anchor:) for this transition. For more info, see Prepare your app for iPhone Duo. How can apps preserve what someone is doing when switching displays or folding/unfolding? Treat this as a resize/trait-change event, not app teardown — your process keeps running as size classes change. See Prepare your app for iPhone Duo to learn more. For scenes that actually disconnect and reconnect, implement stateRestorationActivity(for:) to save an NSUserActivity Restoring your app's state. How does actively playing video behave through the hinge angle animation? The system generally preserves video playback and player position automatically since hinge angle changes are represented as size-class and trait updates, not a scene disconnect or app termination. AVKit will scale and resize the video automatically. If a user folds or unfolds the device mid-checkout, what does the system preserve automatically, and what should the app manage itself to avoid lost input or duplicate requests? When someone opens or closes an iPhone Duo, the system represents this as a size-class and trait collection change, not a scene disconnect or app teardown, so in-memory state like input fields typically persists automatically since the app’s process keeps running. For more info, see Prepare your app for iPhone Duo. How should apps handle the keyboard and text input when the device folds or unfolds while typing? As iPhone Duo folds or unfolds, the available screen geometry and framing change. Ensure your app adopts standard layout controls, containers, and size classes to handle resizability gracefully across all poses. When a text field becomes first responder, the system automatically shows the keyboard and binds its input to the text field. Because the appearance of the keyboard has the potential to obscure portions of your user interface, you should update your interface as needed to ensure that the text field being edited remains visible. Use keyboard notifications such as keyboardWillShowNotification, keyboardWillHideNotification, and keyboardWillChangeFrameNotification to detect the appearance and disappearance of the keyboard and to make necessary changes to your interface layout. To learn more, see UITextField. If someone is typing and closes iPhone Duo, does the keyboard/editing session survive the hinge transition, or does it get a new scene? When a user types and closes iPhone Duo, the active editing session and keyboard do not get a completely new scene. Instead, the app undergoes a dynamic resizing and transitions from the inner display to the compact outer display, maintaining the existing scene and application state. For more info, watch Prepare your app for iPhone Duo.
16
0
7.5k
Sep ’26
WKWebView shows a blank screen for about 30 seconds on first launch on iOS 27
After updating to iOS 27, I noticed a first-launch issue in several apps I developed that use WKWebView. Once the system launch screen disappears, the app shows a completely blank white screen for about 30 seconds before the web content appears. Subsequent launches are fast. I don’t see this delay when running the same app on iOS 26.x. I reproduced the issue on both a physical iPhone and the iOS 27.2 Simulator. It happens when loading a remote HTTPS URL and when displaying a minimal local HTML string with loadHTMLString(_:baseURL:). It also occurs with a default WKWebView configuration and no custom navigation delegate. On the physical iPhone, ContentView.onAppear ran about 0.75 seconds after the app’s initializer, yet the local HTML still took about 30 seconds to become visible. In one Simulator run, WebKit reported that WebContent took about 4 seconds to launch and then logged WebProcessProxy::didBecomeUnresponsive. I suspect a delay during WebKit initialization, but I haven’t established what accounts for the full wait. Has anyone reproduced this first-launch behavior on iOS 27? Is there a known WebKit issue, a specific iOS release that addresses it, or a supported workaround that reduces the delay on physical devices?
Topic: UI Frameworks SubTopic: General
0
0
110
23h
Persistent scroll stutter on iPhone 17 Pro Max, 18 Pro Max and 18 Pro (iOS 27.2), also on Apple Store demo units
Affected devices (all show the same problem): 1x iPhone 17 Pro Max 2x iPhone 18 Pro Max 1x iPhone 18 Pro Many demo iPhones at several Apple Stores Current iOS version: 27.2 Issue: Vertical scrolling inside apps frequently stutters and drops frames. It happens in many, many apps, including Apple's own App Store and Apple Store apps. During a normal flick-and-decelerate scroll, the content repeatedly freezes for one or more frames and then jumps forward. Because this reproduces on four of my own devices and on many Apple Store demo units, I believe it is a widespread, system-level issue, not a defect of a single device or my settings. Impact: I have been living with this for more than six months. I use my iPhone heavily every day, and the constant stutter has made using it genuinely distressing. Everything else about iPhone feels excellent, which makes this problem even harder to accept. Steps to reproduce: Open the App Store app (or almost any app with a scrolling list). Scroll with a normal flick and let it decelerate. Observe repeated hitches during the scroll. Measurements: I filmed the screen with a second iPhone at 4K 120 fps and measured content movement frame by frame: iPhone 18 Pro Max, third-party video feed: about 4 hitches per second of scrolling, about 4% of frames dropped, mostly single-frame drops. iPhone 18 Pro Max, third-party social app list: about 11 hitches per second, about 12% of frames dropped, at a regular rhythm every 6-8 frames. About a third of the stalls last 2-3 frames, and the content does not catch up afterwards. iPhone 17 Pro Max, third-party comment list: about 5 hitches per second, about 8% of frames dropped, including several full freezes of 50-75 ms. Expected: Smooth 120 Hz scrolling, as ProMotion is designed to deliver. Is Apple aware of this issue? I am happy to provide videos, frame-by-frame data, or sysdiagnose logs.
4
2
386
23h
Public API for the iPhone Duo inner-display glow in tent mode
Feature request: Public API for the iPhone Duo inner-display glow in tent mode I’d like a public API for the colored glow that the StandBy alarm casts onto the table in tent mode. It’s a subtle detail that would work well in other apps. The outer display could keep showing the app while the inner glow picks up a color from album artwork or shifts as a timer counts down. The private UIKitCore methods +[_UISceneCompanion _alarmGlowContent] and +[_UISceneCompanion _highlightCompanionWithColor:] point to the effect I mean. SpringBoard also defines SBCompanionScenePresentationModeInnerDisplayStandbyAlarmGlow. In SwiftUI, I could imagine using it like this: .sceneAccessory { InnerDisplayGlowAccessory(color: glowColor) }An optional intensity parameter would be nice, too. That would let apps keep the glow faint during playback or brighten it briefly when something changes, within brightness limits set by iOS.
0
0
85
1d
Document-based app always opens untitled document even when a document is restored
If my NSDocument.canConcurrentlyReadDocuments(ofType:) implementation returns true, often when launching the app, an untitled document is created regardless whether another document is restored. If document reading is not concurrent, an untitled document is only created when no other document is restored, as expected. The issue happens on most app launches when a document is restored. If the restored document takes long to load (which can be simulated by putting sleep(1) in the Document.read(from:ofType:) implementation), the issue always happens. Is this expected, or is there a workaround? I created FB25340015.
Topic: UI Frameworks SubTopic: AppKit Tags:
3
0
153
1d
Mac Catalyst: disabled SwiftUI toolbar buttons turn into pills and don’t update their state
Hi everyone, we’ve been fighting with disabled toolbar buttons in our Mac Catalyst app and wanted to check whether others are seeing the same thing, or whether we’re missing something. Our toolbar lives in a SwiftUI NavigationStack, so Catalyst bridges it into the window’s NSToolbar. Enabled buttons look and work great: native buttons with a round 36 × 36 pt glass. But as soon as a button uses .disabled(_:), things fall apart: It turns into a wider pill. A button that is disabled when it appears becomes an image item instead of a button (NSToolbarImageView with a UIImage), and its glass grows to 47 × 36 pt. Its state doesn’t update. Toggling .disabled(_:) doesn’t reach the existing toolbar item. It only changes if we give the ToolbarItem a new id, which then brings back the pill. Disabling the NSToolbarItem ourselves doesn’t stick. UIKit revalidates the toolbar whenever any item changes, and copies the bar button’s enabled state back over ours. Drawing our own image to fix the shape crashed AppKit (“Unable to install constraint on view”) as soon as the item switched back to enabled. For now we keep the SwiftUI button enabled on the Mac and disable the native NSToolbarItem ourselves. We find the toolbar via NSToolbar.willAddItemNotification and use KVO to put the state back whenever UIKit overrides it. It works, but it feels like it shouldn’t be necessary. Here’s a minimal example: struct ContentView: View { @State private var canUndo = false var body: some View { NavigationStack { Button("Toggle") { canUndo.toggle() } .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Undo", systemImage: "arrow.uturn.backward") {} .labelStyle(.iconOnly) .disabled(!canUndo) } } } } }Seen on macOS 27.2 and 26.7.1, Xcode 27.2. Filed as FB25597608. Is there a supported way to get a disabled toolbar button that stays a normal native button? Any hints are very welcome. Thanks!
0
0
52
2d
SwiftUI TabView with a .prominent tab exhibits unexpected rendering behavior during iPhone Duo display transitions
Hi Apple Support Team, I would like to report an iPhone Duo-specific regression that appears in iOS 27.2.1. The same application behaves correctly on iOS 27.1, and I have been able to reproduce the issue consistently using a minimal sample application. When running the application on iPhone Duo, transitioning from the outer display to the inner display while the device is opened in landscape orientation results in unexpected UI rendering. Specifically, a large arc-shaped visual element associated with a tab configured with the .prominent role appears on screen after the transition. In addition to the rendering issue, we have observed unexpected UI presentation behavior during these display transitions when a tab is assigned the .prominent role. The issue appears to be tied to the .prominent tab role. When all tabs use the default role, the application behaves as expected and neither the rendering issue nor the unexpected UI behavior is observed. A sample application reproducing the issue is attached. Steps to Reproduce Launch the attached sample application on iPhone Duo running iOS 27.2.1. Ensure that one of the tabs is configured with the .prominent role. Start on the outer display. Open the device and transition to the inner display in landscape orientation. Observe the UI during and after the transition. Expected Result TabView should transition cleanly between the outer and inner displays without rendering artifacts or unexpected UI behavior. Actual Result A large arc-shaped visual artifact appears on screen. Unexpected view presentation behavior may occur during the display transition. Multiple animation- and transform-related warnings are logged. // Attached run time logs. Additional Notes Reproducible in both our production application and the attached sample application. The issue appears to be tied to SwiftUI TabView when a tab is assigned the .prominent role. The issue was not observed on iOS 27.1. The issue occurs during transitions between the outer and inner displays on iPhone Duo. Removing the .prominent role eliminates the issue. Could you please let us know whether this is a known issue with SwiftUI TabView and .prominent tabs during iPhone Duo display transitions on iOS 27.2.1? If there is an existing Feedback report, Apple Developer Forums discussion, internal tracking issue, or recommended workaround, we would greatly appreciate any guidance. Screenshots and a sample project are attached. Thank you for your time and assistance. Please let me know if any additional diagnostics, sysdiagnose captures, logs, or sample projects would be helpful. Best regards, Manish
1
0
194
2d
Can a CGVirtualDisplay-based display receive direct touch in macOS 27 (Touch on Mac)?
We ship a macOS app that creates a virtual display with CGVirtualDisplay and streams it to a tablet, which acts as a second screen. Today we deliver the tablet's touches as mouse events (CGEvent), so the system sees a pointer, not touch. With Touch on Mac in macOS 27, we would like the system to treat that display as touch-capable, the way it does for an iPad connected with Sidecar: Can a display created with CGVirtualDisplay report touch capability (NSScreen.touchCapabilities including .multiTouch) and receive direct touches? If not directly, is a virtual HID digitizer (DriverKit or CoreHID) associated with the display's UUID the supported path? Is the com.apple.developer.hid.virtual.device entitlement available for this use? If neither is supported today, what is the recommended way to deliver touch input to a virtual display without mouse emulation? We asked this in the Touch on Mac Group Lab on 20 November and were directed here. Thank you.
0
0
161
2d
Regression: AxisValueLabel multiLabelAlignment parameter ignored in iOS 27
Hello Apple SwiftUI / Swift Charts Engineering Team, I am writing to report a layout regression regarding Swift Charts in iOS 27. The multiLabelAlignment property on AxisValueLabel has stopped working as expected, whereas it functions perfectly in iOS 26. Bug Description: When configuring custom string values within AxisMarks using AxisValueLabel with multiLabelAlignment: .trailing, the alignment configuration is completely ignored on iOS 27. Labels fail to align text properly to the trailing edge, causing rendering layout issues for multi-line or custom text labels on the Y-axis. This exact same implementation compiles and aligns correctly on iOS 26. Code Snippet to Reproduce: swift struct YAxisAlignmentBugView: View { // data points to render the chart frame let data = [(date: Date(), revenue: 3000.0), (date: Date().addingTimeInterval(10000), revenue: 4000.0)] var body: some View { Chart(data, id: .date) { item in LineMark(x: .value("Date", item.date), y: .value("Revenue", item.revenue)) } .frame(height: 300) .padding() .chartYAxis { AxisMarks(preset: .aligned, position: .trailing, values: [12.0, 600.0, 3000.0, 6000.0]) { value in if let revenue = value.as(Double.self) { // BUG: multiLabelAlignment: .trailing is completely ignored on iOS 27 AxisValueLabel("y-(Int(revenue))", anchor: .leading, multiLabelAlignment: .trailing) } } } } } Steps to Reproduce: Render a Swift Chart containing a .chartYAxis configuration with position: .trailing. Pass a string directly using AxisValueLabel(customText, anchor: .leading, multiLabelAlignment: .trailing). Run the application on an iOS 26 simulator (text aligns properly to the trailing edge). Run the identical application code on an iOS 27 simulator. Expected Behavior: The text inside the AxisValueLabel should honor the multiLabelAlignment: .trailing parameter and align the text strings flush right. Actual Behavior: The multiLabelAlignment layout modifier is ignored on iOS 27, resulting in unexpected default left-alignment of the text strings. Attachments: I have attached screenshots from the Xcode Simulator demonstrating the regression: Please let me know if you need any further diagnostic details. Best regards, Soumyajit Das
3
0
336
2d
Regression: AxisValueLabel anchor parameter ignores .topLeading on iOS 27
Hello Apple SwiftUI / Swift Charts Engineering Team, I am writing to report a layout regression regarding Swift Charts in iOS 27. The anchor property on AxisValueLabel has stopped honoring the .topLeading layout coordinate, whereas it functions perfectly in iOS 26. Bug Description: To prevent the first label on a bottom X-axis from clipping past the left screen edge, a .topLeading anchor is applied. In iOS 27, this specific anchor alignment is completely ignored. The chart falls back to a standard top-center alignment, causing the initial boundary label to clip off-screen. Core Code Snippet to Reproduce: struct XAxisAnchorBugView: View { let dates = [ Calendar.current.date(from: DateComponents(year: 2026, month: 10, day: 1))!, Calendar.current.date(from: DateComponents(year: 2026, month: 10, day: 2))! ] var body: some View { Chart(dates, id: .self) { date in LineMark(x: .value("Date", date), y: .value("Value", 100)) } .frame(height: 300) .padding() .chartXAxis { AxisMarks(preset: .aligned, position: .bottom, values: .stride(by: .day, count: 1)) { value in AxisTick() let currentAnchor: UnitPoint = { guard let currentDate = value.as(Date.self) else { return .top } // BUG: .topLeading layout anchor parameter is completely ignored on iOS 27 return (currentDate == dates.first) ? .topLeading : .top }() AxisValueLabel(format: .dateTime.month(.abbreviated).day(), anchor: currentAnchor) } } } } Steps to Reproduce: Render an X-axis with a .bottom position. Assign anchor: .topLeading strictly to the first axis element's label. Run on an iOS 26 simulator (the first label anchors its top-left corner correctly, preventing edge clipping). Run on an iOS 27 simulator (the .topLeading anchor is ignored, reverting to standard top-center alignment). Expected Behavior: AxisValueLabel should position its layout bounding box using the .topLeading anchor point when specified. Actual Behavior: The layout engine ignores the .topLeading parameter on iOS 27, causing the boundary text to shift left and clip. Attachments: I have attached Xcode Simulator screenshots demonstrating this regression: Best regards, Soumyajit Das
3
0
361
2d
How to handle all the core AppleEvents
Glancing through the APIs, SwiftUI can handle the open app, reopen app, open doc, and quit core events (with the “aevt” suite ID). What about the print doc and open content events? If there are no hooks (yet), how can I implement them the traditional way without clashing with SwiftUI?
2
0
815
2d
macOS 27.2: NSStatusItem tooltip stays on screen, then jumps to the pointer when toolTip changes
Environment: macOS Golden Gate 27.3 (26C5035r) arm64, Apple silicon, one display at 2240×1260 (scaled). Symptom. A tooltip window stays on screen at full opacity after the pointer has left. Sometimes it sits in the middle of the screen, far from the menu bar item it belongs to. Hovering or clicking that menu bar item clears it. I've seen it with seven apps: Syncthing, DriveDx and Private Internet Access (menu bar items), and Google Chrome, Chrome Beta, Opera and iTerm2 (tooltips inside their windows). What I measured (polling CGWindowListCopyWindowInfo, plus sample): The stuck window belongs to the app's own process, at window layer 103, alpha 1.0. The app is idle while it's stuck: its main thread is in mach_msg2_trap in 85–100% of samples. In the Chrome and Opera samples the tooltip is handled by NSToolTipManager (displayToolTip:, mouseEnteredToolTip:inWindow:pointInWindow:, fadeToolTip:). Every tooltip is drawn 19–20 pt below where the pointer was when it was shown, so a mid-screen tooltip was shown while the pointer was there. Syncthing (open source) only sets statusItem.button.toolTip, on the main thread, when its status changes. It has no tracking areas or mouse handling of its own. Reproducible part (Syncthing's menu bar item): Have its tooltip stuck. This happens on its own from time to time. I can't trigger it on demand. Leave the pointer anywhere away from the menu bar and change a file in a synced folder, so that Syncthing updates its status and sets a new toolTip. Result: the stuck tooltip window (same window number) moves to 19–20 pt below the current pointer position and stays there. It happened twice in a row, 25 seconds apart, at two different pointer positions. Control: with nothing stuck, 9 such changes (some local, some synced in from another machine) showed no tooltip anywhere. Expected: a tooltip is only shown while the pointer is over its view, and a toolTip change while the pointer is elsewhere shows nothing. So setting toolTip doesn't show a tooltip on its own, it only moves one that is already stuck. I don't know what leaves it stuck in the first place. Possibly related: FB23329983 (status item buttons not getting hover events on macOS 27 betas, reported fixed in beta 5), from this thread. Screenshots of sample tooltips attached.
Topic: UI Frameworks SubTopic: AppKit Tags:
7
2
1k
2d
State Restoration no longer works in a Mac Catalyst based app when run on macOS 27.x
As reported in FB25363417: A UIKit based app running on macOS 27.2 (or macOS 27.0.1) via Mac Catalyst no longer has functioning state restoration. Upon app restart, there is no NSUserActivity being provided to the scene in the UISceneDelegate method scene(_:willConnectTo:options:). This can be tested with Apple’s own sample app “Restoring your app’s state”. Just update the sample project with support for a Mac Catalyst build. Using Xcode 27.2 on a Mac with macOS 27.0 or 27.2, build and run the Mac Catalyst version of the app. The main screen appears with a list of products. Select any product so you see details of the product. Quit the app. Run the app again. Note that you are not returned to the previously selected product detail screen. Instead, you just see the main list of products. If you run the same app and perform the same steps on a Mac running macOS 26.x, then when the app is restarted, you correctly get returned to the previously selected product detail screen. The problem is being caused by no NSUserActivity being passed into the scene delegate on app startup. While running the app on a Mac with macOS 27.x, put a breakpoint on the initial guard statement in scene(_:willConnectTo:options:) and you will see there is no activity on app restart. This is impacting paid customers of my existing app since upgrading to macOS 27. They no longer get returned to the app’s previous state when restarting the app. It is expected that state restoration should work on macOS 27 just as well as it does under macOS 26 in an app built with Mac Catalyst.
1
0
163
2d
iPhone Duo vertical bar: system back button ignores custom back indicator image (UINavigationBarAppearance.setBackIndicatorImage)
On iPhone Duo (iOS 27.1), when UIKit moves a navigation controller's system back button into the vertical bar, the button always shows the system chevron. Every public API for customizing the back indicator image is ignored there, although the same configuration is honored in the horizontal (top) navigation bar. APIs tested (each one alone, on the second view controller of a UINavigationController stack, with no leftBarButtonItem): A. Nothing set (default). B. UINavigationBar.standardAppearance set to a UINavigationBarAppearance on which setBackIndicatorImage(_:transitionMaskImage:) was called. C. Same appearance assigned to all four UINavigationBar properties: standardAppearance, compactAppearance, scrollEdgeAppearance, compactScrollEdgeAppearance. D. Same appearance assigned to all four UINavigationItem properties of the pushed view controller: standardAppearance, compactAppearance, scrollEdgeAppearance, compactScrollEdgeAppearance. E. Legacy UINavigationBar.backIndicatorImage and UINavigationBar.backIndicatorTransitionMaskImage, with no appearance objects set. F. UINavigationBar.appearance() proxy: all four appearance properties, set before the navigation controller is created. G. UINavigationItem.backBarButtonItem of the previous view controller set to UIBarButtonItem(image:style:target:action:). H. Control: UINavigationItem.leftBarButtonItem set to UIBarButtonItem(image:style:target:action:) with the same image (axisBehavior left at .automatic). The marker image is UIImage(systemName: "arrow.uturn.backward"), so it cannot be mistaken for the system chevron. Results: Top navigation bar (iPhone 17 Pro iOS 27.0, and iPhone Duo open with portrait UI): B, C, D, E and F show the custom image. G shows the chevron followed by the image. Vertical bar (iPhone Duo closed; iPhone Duo open with landscape UI; also inside a UITabBarController with the tab bar hidden or visible): A through G all show the system chevron. Only H shows the custom image. At viewDidAppear, the app confirms that the configuration is in place: navigationBar.standardAppearance.backIndicatorImage is the marker image (B, C), navigationItem.standardAppearance is non-nil (D), and traitCollection.verticalBarEdge is .trailing. This contradicts the guidance given by an Apple Technology Evangelist in https://developer.apple.com/forums/thread/847875: "If you are only replacing the icon on the back button, you could use set the backIndicatorImage and maintain default system behavior. This would be the recommended approach." As things stand, the only way to show a custom back icon in the vertical bar is to replace the system back button with a leading item. That loses the system behavior that comes with it: UINavigationController.interactivePopGestureRecognizer, interactiveContentPopGestureRecognizer and the back-history menu.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
3
549
2d
didUpdateEffectiveGeometry reports outer display frame when app is send to background while using the inner display.
On iPhone Duo, when the app goes into background while being used on the inner display, windowScene(_:didUpdateEffectiveGeometry:) is called with a frame matching the geometry of the outer display.  When the app returns to the foreground, the callback fires again with the inner display geometry. We reload our layouts based on this callback so the transient frame cause a visible relayout when returning to the app. This also reproduces when building with Xcode 27.3 beta and on OS version 27.2.0. Snippet: func windowScene(_ windowScene: UIWindowScene, didUpdateEffectiveGeometry previousEffectiveGeometry: UIWindowScene.Geometry) { log("didUpdateEffectiveGeometry", windowScene) } func sceneDidEnterBackground(_ scene: UIScene) { log("sceneDidEnterBackground", scene) } func sceneWillEnterForeground(_ scene: UIScene) { log("sceneWillEnterForeground", scene) } private func log(_ event: String, _ scene: UIScene) { guard let windowScene = scene as? UIWindowScene else { return } let state = windowScene.activationState == .background ? "background" : "foreground" let size = windowScene.effectiveGeometry.coordinateSpace.bounds.size print("\(event) | state: \(state) | size: \(Int(size.width)) x \(Int(size.height))") }Logs: sceneDidEnterBackground | state: background | size: 951 x 669 didUpdateEffectiveGeometry | state: background | size: 466 x 678 <- outer display size, device NOT folded didUpdateEffectiveGeometry | state: background | size: 951 x 669 sceneWillEnterForeground | state: background | size: 951 x 669Is this the expected behaviour, or a known issue? If it’s expected, what’s the recommended way to distinguish the effective geometry change?
Topic: UI Frameworks SubTopic: UIKit
0
0
29
2d
UITableView row reordering no longer works under macOS 27 with Mac Catalyst
Under macOS 27 using Mac Catalyst for a UIKit-based app, If you present a view controller with a table view as a form sheet or page sheet, row reordering fails to function. You can drag a row as expected but the blue movement bar never appears and if you drop the row it simply returns to its original location. The exact same view controller presented as a popover works just fine. The exact same view controller not presented as a modal (such as the app's root controller) works just fine. This is a serious bug affecting existing applications and being reported by paying customers. This has been reported as FB25038883 which includes a simple sample app demonstrating the issue.
4
1
571
2d
iPhone Duo Unfolded Safe Areas
Hi, my app is currently built on Xcode 27.1 I am working on upgrading to Xcode 27.2 We have a regression issue whereby, the top safeArea is 82 despite the vertical bar being opted in and active. This only happens on unfolded landscape. Our right safeArea is 0 for the window and is 84 for the view safeArea. Both window and view safeAreas have the top safe area of 82 though. We would like to know what could be the cause behind the top safeArea being activated. Note: this is not an issue for iOS 27.1
2
0
205
3d
SwiftUI Architecture Guide
Application Types Applications are divided into Document-based and Library-based. A document-based application stores user data in individual, standalone files. Users manually name and organize those files in a local system or synced cloud storage such as iCloud. The software typically opens multiple windows for different projects. This framing is for standalone, complex files that need to be shared, exported, or handled independently. A library-based application manages data in one unified, central repository, locally or through remote cloud databases. Spotify, Netflix, and Notion are the examples shown. The file system is hidden; updates are saved automatically in real time; and a single window supports browsing, search, and access to the synchronized data collection from any device. Model Types Four model types: Data, Domain, Application, and Presentation. Apple Platforms In Apple MVC (AppKit / UIKit), the model branches to Data, Domain, and Presentation. In SwiftUI, Model branches to Data and Domain. Project Structure SwiftUI App Folders Swift Package Folders App Modularization Not every module in a large application needs to be extracted into a separate framework or Swift Package. Logical modularization can also be achieved through a well-organized folder structure within the main project. Introduce separate packages or frameworks only when there is a clear benefit, such as independent reuse, distribution, build isolation or ownership. Avoid unnecessary project and dependency management overhead. State Management & Data Flow Source of truth is “a key concept in SwiftUI”: a single place to store a piece of data, with everywhere else reading the same piece of data. Environment is SwiftUI’s native dependency-injection mechanism. It allows shared dependencies, domain models, and services to be injected at the appropriate view-hierarchy level and accessed where needed without explicit parameter passing or unnecessary coupling. It is described as a tool for managing dependencies and sharing state across the view hierarchy. Domain Model Ownership Domain Models should be owned by the highest relevant SwiftUI view in the hierarchy that defines their context and lifecycle. NavigationStack owns the Domain Models for its navigation context and makes them available to descendant views through @Environment. When a NavigationStack is embedded in a TabView or NavigationSplitView, ownership moves up to the TabView or NavigationSplitView so the models can be shared across tabs or split views. The stated result is clear ownership scope, sharing where needed, and isolation between independent navigation contexts. Previews & UI Testing Environment injection makes SwiftUI Previews and UI Tests easier to configure by allowing real Domain Models to be replaced with mock or dummy instances. Views can be tested independently with controlled data and predictable states, without requiring real services, network requests, or application setup. Domain and Data Model Examples For a library-based app with remote data. Additional Domain Model Examples E-commerce Catalog, ShoppingCart, OrderHistory, Wishlist Banking MyAccounts, MyCards, MyTransactions, MyInvestments Social Network Feed, Conversations, Notifications, Friends Healthcare MyAppointments, MedicalHistory, Prescriptions, MyHealth Education Courses, MyCourses, Assignments, MyGrades, LearningProgress Real Estate PropertyCatalog, MyProperties, Favorites, Appointments Hotel Booking Destinations, Search, MyBookings, TravelHistory Food Delivery RestaurantCatalog, ShoppingCart, MyOrders, DeliveryTracking Project Management Projects, MyTasks, TeamMembers, Notifications Insurance MyPolicies, MyClaims, Coverage, Documents Smart Home MyHomes, Devices, Automations, EnergyUsage Fitness MyPlans, MyProgress, MyGoals, WorkoutHistory Other Search, Dashboard, Favorites, Notifications, Settings, ActivityHistory, Recommendations, Subscription, DocumentLibrary ViewModel? - MVVM In SwiftUI, the View encapsulates the UI content (body), its state (properties), and its actions or tasks (functions). This is possible because SwiftUI is designed around a declarative, state-driven UI model. In Android and .NET platforms, a separate ViewModel is typically required to hold and manage the View's state. Projects that intoduce ViewModels in SwiftUI add unnecessary architectural complexity, boilerplate, and code duplication; synchronization issues; unclear state ownership; additional lifecycle management; more abstractions; harder debugging; and increased maintenance, without meaningful benefits over SwiftUI's native state management. In UIKit, introducing a separate ViewModel layer is often unnecessary, as UIViewController already serves as the presentation model, handling presentation logic and coordinating the view. Non-UI responsibilities can be delegated to dedicated ModelControllers or Managers, avoiding unnecessary layers and abstractions. Domain Models vs. ViewModels Domain Models are view-independent, while ViewModels are view-dependent. A ViewModel is tightly coupled to the structure, state, and lifecycle of a specific View. Whenever the View code changes, its ViewModel often requires corresponding coding changes, and vice versa, creating additional maintenance and synchronization overhead. Domain Models, on the other hand, represent application context and business functionality independently of the UI. This separation preserves UI independence and allows the same Domain Models to be shared across different screens and platforms, such as iPhone, iPhone Duo, iPad, and macOS, without duplicating or adapting business logic for each View. This makes Domain Models a more scalable and maintainable approach for modern SwiftUI applications, particularly those targeting multiple screen sizes and platforms.
1
0
265
3d
SwiftUI custom focusable view cannot acquire focus programmatically on iPad with a hardware keyboard connected
On iPad, a SwiftUI view using .focusable(interactions: .edit) and .focused($isFocused) cannot acquire focus when a hardware keyboard is already connected. Setting isFocused = true from a button leaves it false. Tapping the view also leaves it unfocused, although the tap is received. Pressing Tab can focus the same view. struct FocusProbeView: View { @FocusState private var isFocused: Bool var body: some View { VStack { Text("Target") .focusable(interactions: .edit) .focused($isFocused) .onTapGesture { print("Target tapped") } Text("isFocused = \(isFocused)") Button("Focus target") { isFocused = true } } .defaultFocus($isFocused, true) } }Steps to reproduce: Run this view on an iPad with a hardware keyboard connected. Tap “Focus target”, then tap “Target”. Observe that isFocused remains false. Press Tab. The target can receive focus through keyboard navigation. Disconnect the keyboard. Restart the app and tap “Focus target” again. isFocused becomes true. Reconnecting the keyboard does not remove that focus. Expected: A visible custom view marked .focusable(interactions: .edit) can receive focus through @FocusState, including when a hardware keyboard is connected. Actual: Programmatic focus fails when the keyboard is already connected. A native TextField tested with the same button and @FocusState does receive focus. Environment: iPad model: MU1V2NF/A; iPadOS version: 26.7.2; Xcode version: 27.2; hardware keyboard: Logi Folio Touch. iPad model: Device Hub iPad Pro 11-inch (M5); iPadOS version: 27.2; Xcode version: 27.2; hardware keyboard: Device Hub.
1
0
230
3d
Various menu bar NSStatusItem issues with macOS 27
It seems like macOS 27 beta 2 has some issues with NSStatusItem buttons added to the menu bar - this creates difficulties for some menu bar extra apps. NSStatusItem buttons does not receive mouse hover/movement events - FB23329983 On macOS 27, views inside an NSStatusItem button no longer receive hover or mouse-movement events. The same code works correctly on macOS 26. What I tried: An NSTrackingArea attached to a subview of NSStatusBarButton An NSTrackingArea attached directly to the status-bar button Replacing NSStatusItem.view with a custom view Embedding an NSHostingView and using SwiftUI onHover/onContinuousHover NSStatusItem button highlight cannot be set programmatically. - FB23330269 The following code no longer has any effect (does not provide the highlight capsule): NSStatusItem.button?.highlight(true) NSStatusItem window occlusionState no longer reflects hidden menu bar visibility - FB23349447 The following no longer works: statusItem.button?.window?.occlusionState.contains(.visible) These changes may be related to some of the touch related changes or maybe it's about how menu items are now seemingly more "managed" in a way that their position, visibility may change in a way that is transparent/undetectable to the app.
9
2
1.8k
3d
A Summary of the iPhone Duo Group Lab
Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the iPhone Duo Group Labs: How should apps preserve navigation and UI state when switching between the inner and outer displays? Treat display transitions as size-class and trait changes, not a scene disconnect or app termination; your process stays alive. For more information, see Prepare your app for iPhone Duo. For state that must survive a scene disconnect/reconnect, implement stateRestorationActivity(for:) to save an NSUserActivity Restoring your app's state. Do multiple instances of the same app on iPhone Duo share UserDefaults/@AppStorage state? Multiple instances of your app's UI on iPhone Duo behave similarly to multi-window support on iPadOS. To learn more, see Leverage multiple displays and scenes on iPhone Duo. Both UserDefaults and AppStorage are app-wide, not per-window, stores. If a full-screen app on the inner display is closed, does it move to the outer display or get backgrounded? iPhone Duo honors UIRequiresFullScreen and apps adapt in place as the device opens and closes rather than backgrounding. To learn more, watch Prepare your app for iPhone Duo. How should apps preserve state — text input, scroll position, video playback, camera sessions — during hinge angle transitions? For example, when a LazyVGrid's column count changes because the device folds, does SwiftUI preserve scroll position automatically, or should you use scrollPosition(id:)? The system generally preserves text input and scroll position automatically since hinge angle changes are represented as size-class and trait updates, not a scene disconnect or app termination. This applies even to cases like a LazyVGrid column-count change triggered by opening or closing the device — apps typically don't need to manually manage scroll position with scrollPosition(id:anchor:) for this transition. For more info, see Prepare your app for iPhone Duo. How can apps preserve what someone is doing when switching displays or folding/unfolding? Treat this as a resize/trait-change event, not app teardown — your process keeps running as size classes change. See Prepare your app for iPhone Duo to learn more. For scenes that actually disconnect and reconnect, implement stateRestorationActivity(for:) to save an NSUserActivity Restoring your app's state. How does actively playing video behave through the hinge angle animation? The system generally preserves video playback and player position automatically since hinge angle changes are represented as size-class and trait updates, not a scene disconnect or app termination. AVKit will scale and resize the video automatically. If a user folds or unfolds the device mid-checkout, what does the system preserve automatically, and what should the app manage itself to avoid lost input or duplicate requests? When someone opens or closes an iPhone Duo, the system represents this as a size-class and trait collection change, not a scene disconnect or app teardown, so in-memory state like input fields typically persists automatically since the app’s process keeps running. For more info, see Prepare your app for iPhone Duo. How should apps handle the keyboard and text input when the device folds or unfolds while typing? As iPhone Duo folds or unfolds, the available screen geometry and framing change. Ensure your app adopts standard layout controls, containers, and size classes to handle resizability gracefully across all poses. When a text field becomes first responder, the system automatically shows the keyboard and binds its input to the text field. Because the appearance of the keyboard has the potential to obscure portions of your user interface, you should update your interface as needed to ensure that the text field being edited remains visible. Use keyboard notifications such as keyboardWillShowNotification, keyboardWillHideNotification, and keyboardWillChangeFrameNotification to detect the appearance and disappearance of the keyboard and to make necessary changes to your interface layout. To learn more, see UITextField. If someone is typing and closes iPhone Duo, does the keyboard/editing session survive the hinge transition, or does it get a new scene? When a user types and closes iPhone Duo, the active editing session and keyboard do not get a completely new scene. Instead, the app undergoes a dynamic resizing and transitions from the inner display to the compact outer display, maintaining the existing scene and application state. For more info, watch Prepare your app for iPhone Duo.
Replies
16
Boosts
0
Views
7.5k
Activity
Sep ’26
WKWebView shows a blank screen for about 30 seconds on first launch on iOS 27
After updating to iOS 27, I noticed a first-launch issue in several apps I developed that use WKWebView. Once the system launch screen disappears, the app shows a completely blank white screen for about 30 seconds before the web content appears. Subsequent launches are fast. I don’t see this delay when running the same app on iOS 26.x. I reproduced the issue on both a physical iPhone and the iOS 27.2 Simulator. It happens when loading a remote HTTPS URL and when displaying a minimal local HTML string with loadHTMLString(_:baseURL:). It also occurs with a default WKWebView configuration and no custom navigation delegate. On the physical iPhone, ContentView.onAppear ran about 0.75 seconds after the app’s initializer, yet the local HTML still took about 30 seconds to become visible. In one Simulator run, WebKit reported that WebContent took about 4 seconds to launch and then logged WebProcessProxy::didBecomeUnresponsive. I suspect a delay during WebKit initialization, but I haven’t established what accounts for the full wait. Has anyone reproduced this first-launch behavior on iOS 27? Is there a known WebKit issue, a specific iOS release that addresses it, or a supported workaround that reduces the delay on physical devices?
Topic: UI Frameworks SubTopic: General
Replies
0
Boosts
0
Views
110
Activity
23h
Persistent scroll stutter on iPhone 17 Pro Max, 18 Pro Max and 18 Pro (iOS 27.2), also on Apple Store demo units
Affected devices (all show the same problem): 1x iPhone 17 Pro Max 2x iPhone 18 Pro Max 1x iPhone 18 Pro Many demo iPhones at several Apple Stores Current iOS version: 27.2 Issue: Vertical scrolling inside apps frequently stutters and drops frames. It happens in many, many apps, including Apple's own App Store and Apple Store apps. During a normal flick-and-decelerate scroll, the content repeatedly freezes for one or more frames and then jumps forward. Because this reproduces on four of my own devices and on many Apple Store demo units, I believe it is a widespread, system-level issue, not a defect of a single device or my settings. Impact: I have been living with this for more than six months. I use my iPhone heavily every day, and the constant stutter has made using it genuinely distressing. Everything else about iPhone feels excellent, which makes this problem even harder to accept. Steps to reproduce: Open the App Store app (or almost any app with a scrolling list). Scroll with a normal flick and let it decelerate. Observe repeated hitches during the scroll. Measurements: I filmed the screen with a second iPhone at 4K 120 fps and measured content movement frame by frame: iPhone 18 Pro Max, third-party video feed: about 4 hitches per second of scrolling, about 4% of frames dropped, mostly single-frame drops. iPhone 18 Pro Max, third-party social app list: about 11 hitches per second, about 12% of frames dropped, at a regular rhythm every 6-8 frames. About a third of the stalls last 2-3 frames, and the content does not catch up afterwards. iPhone 17 Pro Max, third-party comment list: about 5 hitches per second, about 8% of frames dropped, including several full freezes of 50-75 ms. Expected: Smooth 120 Hz scrolling, as ProMotion is designed to deliver. Is Apple aware of this issue? I am happy to provide videos, frame-by-frame data, or sysdiagnose logs.
Replies
4
Boosts
2
Views
386
Activity
23h
Public API for the iPhone Duo inner-display glow in tent mode
Feature request: Public API for the iPhone Duo inner-display glow in tent mode I’d like a public API for the colored glow that the StandBy alarm casts onto the table in tent mode. It’s a subtle detail that would work well in other apps. The outer display could keep showing the app while the inner glow picks up a color from album artwork or shifts as a timer counts down. The private UIKitCore methods +[_UISceneCompanion _alarmGlowContent] and +[_UISceneCompanion _highlightCompanionWithColor:] point to the effect I mean. SpringBoard also defines SBCompanionScenePresentationModeInnerDisplayStandbyAlarmGlow. In SwiftUI, I could imagine using it like this: .sceneAccessory { InnerDisplayGlowAccessory(color: glowColor) }An optional intensity parameter would be nice, too. That would let apps keep the glow faint during playback or brighten it briefly when something changes, within brightness limits set by iOS.
Replies
0
Boosts
0
Views
85
Activity
1d
Document-based app always opens untitled document even when a document is restored
If my NSDocument.canConcurrentlyReadDocuments(ofType:) implementation returns true, often when launching the app, an untitled document is created regardless whether another document is restored. If document reading is not concurrent, an untitled document is only created when no other document is restored, as expected. The issue happens on most app launches when a document is restored. If the restored document takes long to load (which can be simulated by putting sleep(1) in the Document.read(from:ofType:) implementation), the issue always happens. Is this expected, or is there a workaround? I created FB25340015.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
3
Boosts
0
Views
153
Activity
1d
Mac Catalyst: disabled SwiftUI toolbar buttons turn into pills and don’t update their state
Hi everyone, we’ve been fighting with disabled toolbar buttons in our Mac Catalyst app and wanted to check whether others are seeing the same thing, or whether we’re missing something. Our toolbar lives in a SwiftUI NavigationStack, so Catalyst bridges it into the window’s NSToolbar. Enabled buttons look and work great: native buttons with a round 36 × 36 pt glass. But as soon as a button uses .disabled(_:), things fall apart: It turns into a wider pill. A button that is disabled when it appears becomes an image item instead of a button (NSToolbarImageView with a UIImage), and its glass grows to 47 × 36 pt. Its state doesn’t update. Toggling .disabled(_:) doesn’t reach the existing toolbar item. It only changes if we give the ToolbarItem a new id, which then brings back the pill. Disabling the NSToolbarItem ourselves doesn’t stick. UIKit revalidates the toolbar whenever any item changes, and copies the bar button’s enabled state back over ours. Drawing our own image to fix the shape crashed AppKit (“Unable to install constraint on view”) as soon as the item switched back to enabled. For now we keep the SwiftUI button enabled on the Mac and disable the native NSToolbarItem ourselves. We find the toolbar via NSToolbar.willAddItemNotification and use KVO to put the state back whenever UIKit overrides it. It works, but it feels like it shouldn’t be necessary. Here’s a minimal example: struct ContentView: View { @State private var canUndo = false var body: some View { NavigationStack { Button("Toggle") { canUndo.toggle() } .toolbar { ToolbarItem(placement: .topBarLeading) { Button("Undo", systemImage: "arrow.uturn.backward") {} .labelStyle(.iconOnly) .disabled(!canUndo) } } } } }Seen on macOS 27.2 and 26.7.1, Xcode 27.2. Filed as FB25597608. Is there a supported way to get a disabled toolbar button that stays a normal native button? Any hints are very welcome. Thanks!
Replies
0
Boosts
0
Views
52
Activity
2d
SwiftUI TabView with a .prominent tab exhibits unexpected rendering behavior during iPhone Duo display transitions
Hi Apple Support Team, I would like to report an iPhone Duo-specific regression that appears in iOS 27.2.1. The same application behaves correctly on iOS 27.1, and I have been able to reproduce the issue consistently using a minimal sample application. When running the application on iPhone Duo, transitioning from the outer display to the inner display while the device is opened in landscape orientation results in unexpected UI rendering. Specifically, a large arc-shaped visual element associated with a tab configured with the .prominent role appears on screen after the transition. In addition to the rendering issue, we have observed unexpected UI presentation behavior during these display transitions when a tab is assigned the .prominent role. The issue appears to be tied to the .prominent tab role. When all tabs use the default role, the application behaves as expected and neither the rendering issue nor the unexpected UI behavior is observed. A sample application reproducing the issue is attached. Steps to Reproduce Launch the attached sample application on iPhone Duo running iOS 27.2.1. Ensure that one of the tabs is configured with the .prominent role. Start on the outer display. Open the device and transition to the inner display in landscape orientation. Observe the UI during and after the transition. Expected Result TabView should transition cleanly between the outer and inner displays without rendering artifacts or unexpected UI behavior. Actual Result A large arc-shaped visual artifact appears on screen. Unexpected view presentation behavior may occur during the display transition. Multiple animation- and transform-related warnings are logged. // Attached run time logs. Additional Notes Reproducible in both our production application and the attached sample application. The issue appears to be tied to SwiftUI TabView when a tab is assigned the .prominent role. The issue was not observed on iOS 27.1. The issue occurs during transitions between the outer and inner displays on iPhone Duo. Removing the .prominent role eliminates the issue. Could you please let us know whether this is a known issue with SwiftUI TabView and .prominent tabs during iPhone Duo display transitions on iOS 27.2.1? If there is an existing Feedback report, Apple Developer Forums discussion, internal tracking issue, or recommended workaround, we would greatly appreciate any guidance. Screenshots and a sample project are attached. Thank you for your time and assistance. Please let me know if any additional diagnostics, sysdiagnose captures, logs, or sample projects would be helpful. Best regards, Manish
Replies
1
Boosts
0
Views
194
Activity
2d
Can a CGVirtualDisplay-based display receive direct touch in macOS 27 (Touch on Mac)?
We ship a macOS app that creates a virtual display with CGVirtualDisplay and streams it to a tablet, which acts as a second screen. Today we deliver the tablet's touches as mouse events (CGEvent), so the system sees a pointer, not touch. With Touch on Mac in macOS 27, we would like the system to treat that display as touch-capable, the way it does for an iPad connected with Sidecar: Can a display created with CGVirtualDisplay report touch capability (NSScreen.touchCapabilities including .multiTouch) and receive direct touches? If not directly, is a virtual HID digitizer (DriverKit or CoreHID) associated with the display's UUID the supported path? Is the com.apple.developer.hid.virtual.device entitlement available for this use? If neither is supported today, what is the recommended way to deliver touch input to a virtual display without mouse emulation? We asked this in the Touch on Mac Group Lab on 20 November and were directed here. Thank you.
Replies
0
Boosts
0
Views
161
Activity
2d
Regression: AxisValueLabel multiLabelAlignment parameter ignored in iOS 27
Hello Apple SwiftUI / Swift Charts Engineering Team, I am writing to report a layout regression regarding Swift Charts in iOS 27. The multiLabelAlignment property on AxisValueLabel has stopped working as expected, whereas it functions perfectly in iOS 26. Bug Description: When configuring custom string values within AxisMarks using AxisValueLabel with multiLabelAlignment: .trailing, the alignment configuration is completely ignored on iOS 27. Labels fail to align text properly to the trailing edge, causing rendering layout issues for multi-line or custom text labels on the Y-axis. This exact same implementation compiles and aligns correctly on iOS 26. Code Snippet to Reproduce: swift struct YAxisAlignmentBugView: View { // data points to render the chart frame let data = [(date: Date(), revenue: 3000.0), (date: Date().addingTimeInterval(10000), revenue: 4000.0)] var body: some View { Chart(data, id: .date) { item in LineMark(x: .value("Date", item.date), y: .value("Revenue", item.revenue)) } .frame(height: 300) .padding() .chartYAxis { AxisMarks(preset: .aligned, position: .trailing, values: [12.0, 600.0, 3000.0, 6000.0]) { value in if let revenue = value.as(Double.self) { // BUG: multiLabelAlignment: .trailing is completely ignored on iOS 27 AxisValueLabel("y-(Int(revenue))", anchor: .leading, multiLabelAlignment: .trailing) } } } } } Steps to Reproduce: Render a Swift Chart containing a .chartYAxis configuration with position: .trailing. Pass a string directly using AxisValueLabel(customText, anchor: .leading, multiLabelAlignment: .trailing). Run the application on an iOS 26 simulator (text aligns properly to the trailing edge). Run the identical application code on an iOS 27 simulator. Expected Behavior: The text inside the AxisValueLabel should honor the multiLabelAlignment: .trailing parameter and align the text strings flush right. Actual Behavior: The multiLabelAlignment layout modifier is ignored on iOS 27, resulting in unexpected default left-alignment of the text strings. Attachments: I have attached screenshots from the Xcode Simulator demonstrating the regression: Please let me know if you need any further diagnostic details. Best regards, Soumyajit Das
Replies
3
Boosts
0
Views
336
Activity
2d
Regression: AxisValueLabel anchor parameter ignores .topLeading on iOS 27
Hello Apple SwiftUI / Swift Charts Engineering Team, I am writing to report a layout regression regarding Swift Charts in iOS 27. The anchor property on AxisValueLabel has stopped honoring the .topLeading layout coordinate, whereas it functions perfectly in iOS 26. Bug Description: To prevent the first label on a bottom X-axis from clipping past the left screen edge, a .topLeading anchor is applied. In iOS 27, this specific anchor alignment is completely ignored. The chart falls back to a standard top-center alignment, causing the initial boundary label to clip off-screen. Core Code Snippet to Reproduce: struct XAxisAnchorBugView: View { let dates = [ Calendar.current.date(from: DateComponents(year: 2026, month: 10, day: 1))!, Calendar.current.date(from: DateComponents(year: 2026, month: 10, day: 2))! ] var body: some View { Chart(dates, id: .self) { date in LineMark(x: .value("Date", date), y: .value("Value", 100)) } .frame(height: 300) .padding() .chartXAxis { AxisMarks(preset: .aligned, position: .bottom, values: .stride(by: .day, count: 1)) { value in AxisTick() let currentAnchor: UnitPoint = { guard let currentDate = value.as(Date.self) else { return .top } // BUG: .topLeading layout anchor parameter is completely ignored on iOS 27 return (currentDate == dates.first) ? .topLeading : .top }() AxisValueLabel(format: .dateTime.month(.abbreviated).day(), anchor: currentAnchor) } } } } Steps to Reproduce: Render an X-axis with a .bottom position. Assign anchor: .topLeading strictly to the first axis element's label. Run on an iOS 26 simulator (the first label anchors its top-left corner correctly, preventing edge clipping). Run on an iOS 27 simulator (the .topLeading anchor is ignored, reverting to standard top-center alignment). Expected Behavior: AxisValueLabel should position its layout bounding box using the .topLeading anchor point when specified. Actual Behavior: The layout engine ignores the .topLeading parameter on iOS 27, causing the boundary text to shift left and clip. Attachments: I have attached Xcode Simulator screenshots demonstrating this regression: Best regards, Soumyajit Das
Replies
3
Boosts
0
Views
361
Activity
2d
How to handle all the core AppleEvents
Glancing through the APIs, SwiftUI can handle the open app, reopen app, open doc, and quit core events (with the “aevt” suite ID). What about the print doc and open content events? If there are no hooks (yet), how can I implement them the traditional way without clashing with SwiftUI?
Replies
2
Boosts
0
Views
815
Activity
2d
macOS 27.2: NSStatusItem tooltip stays on screen, then jumps to the pointer when toolTip changes
Environment: macOS Golden Gate 27.3 (26C5035r) arm64, Apple silicon, one display at 2240×1260 (scaled). Symptom. A tooltip window stays on screen at full opacity after the pointer has left. Sometimes it sits in the middle of the screen, far from the menu bar item it belongs to. Hovering or clicking that menu bar item clears it. I've seen it with seven apps: Syncthing, DriveDx and Private Internet Access (menu bar items), and Google Chrome, Chrome Beta, Opera and iTerm2 (tooltips inside their windows). What I measured (polling CGWindowListCopyWindowInfo, plus sample): The stuck window belongs to the app's own process, at window layer 103, alpha 1.0. The app is idle while it's stuck: its main thread is in mach_msg2_trap in 85–100% of samples. In the Chrome and Opera samples the tooltip is handled by NSToolTipManager (displayToolTip:, mouseEnteredToolTip:inWindow:pointInWindow:, fadeToolTip:). Every tooltip is drawn 19–20 pt below where the pointer was when it was shown, so a mid-screen tooltip was shown while the pointer was there. Syncthing (open source) only sets statusItem.button.toolTip, on the main thread, when its status changes. It has no tracking areas or mouse handling of its own. Reproducible part (Syncthing's menu bar item): Have its tooltip stuck. This happens on its own from time to time. I can't trigger it on demand. Leave the pointer anywhere away from the menu bar and change a file in a synced folder, so that Syncthing updates its status and sets a new toolTip. Result: the stuck tooltip window (same window number) moves to 19–20 pt below the current pointer position and stays there. It happened twice in a row, 25 seconds apart, at two different pointer positions. Control: with nothing stuck, 9 such changes (some local, some synced in from another machine) showed no tooltip anywhere. Expected: a tooltip is only shown while the pointer is over its view, and a toolTip change while the pointer is elsewhere shows nothing. So setting toolTip doesn't show a tooltip on its own, it only moves one that is already stuck. I don't know what leaves it stuck in the first place. Possibly related: FB23329983 (status item buttons not getting hover events on macOS 27 betas, reported fixed in beta 5), from this thread. Screenshots of sample tooltips attached.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
7
Boosts
2
Views
1k
Activity
2d
State Restoration no longer works in a Mac Catalyst based app when run on macOS 27.x
As reported in FB25363417: A UIKit based app running on macOS 27.2 (or macOS 27.0.1) via Mac Catalyst no longer has functioning state restoration. Upon app restart, there is no NSUserActivity being provided to the scene in the UISceneDelegate method scene(_:willConnectTo:options:). This can be tested with Apple’s own sample app “Restoring your app’s state”. Just update the sample project with support for a Mac Catalyst build. Using Xcode 27.2 on a Mac with macOS 27.0 or 27.2, build and run the Mac Catalyst version of the app. The main screen appears with a list of products. Select any product so you see details of the product. Quit the app. Run the app again. Note that you are not returned to the previously selected product detail screen. Instead, you just see the main list of products. If you run the same app and perform the same steps on a Mac running macOS 26.x, then when the app is restarted, you correctly get returned to the previously selected product detail screen. The problem is being caused by no NSUserActivity being passed into the scene delegate on app startup. While running the app on a Mac with macOS 27.x, put a breakpoint on the initial guard statement in scene(_:willConnectTo:options:) and you will see there is no activity on app restart. This is impacting paid customers of my existing app since upgrading to macOS 27. They no longer get returned to the app’s previous state when restarting the app. It is expected that state restoration should work on macOS 27 just as well as it does under macOS 26 in an app built with Mac Catalyst.
Replies
1
Boosts
0
Views
163
Activity
2d
iPhone Duo vertical bar: system back button ignores custom back indicator image (UINavigationBarAppearance.setBackIndicatorImage)
On iPhone Duo (iOS 27.1), when UIKit moves a navigation controller's system back button into the vertical bar, the button always shows the system chevron. Every public API for customizing the back indicator image is ignored there, although the same configuration is honored in the horizontal (top) navigation bar. APIs tested (each one alone, on the second view controller of a UINavigationController stack, with no leftBarButtonItem): A. Nothing set (default). B. UINavigationBar.standardAppearance set to a UINavigationBarAppearance on which setBackIndicatorImage(_:transitionMaskImage:) was called. C. Same appearance assigned to all four UINavigationBar properties: standardAppearance, compactAppearance, scrollEdgeAppearance, compactScrollEdgeAppearance. D. Same appearance assigned to all four UINavigationItem properties of the pushed view controller: standardAppearance, compactAppearance, scrollEdgeAppearance, compactScrollEdgeAppearance. E. Legacy UINavigationBar.backIndicatorImage and UINavigationBar.backIndicatorTransitionMaskImage, with no appearance objects set. F. UINavigationBar.appearance() proxy: all four appearance properties, set before the navigation controller is created. G. UINavigationItem.backBarButtonItem of the previous view controller set to UIBarButtonItem(image:style:target:action:). H. Control: UINavigationItem.leftBarButtonItem set to UIBarButtonItem(image:style:target:action:) with the same image (axisBehavior left at .automatic). The marker image is UIImage(systemName: "arrow.uturn.backward"), so it cannot be mistaken for the system chevron. Results: Top navigation bar (iPhone 17 Pro iOS 27.0, and iPhone Duo open with portrait UI): B, C, D, E and F show the custom image. G shows the chevron followed by the image. Vertical bar (iPhone Duo closed; iPhone Duo open with landscape UI; also inside a UITabBarController with the tab bar hidden or visible): A through G all show the system chevron. Only H shows the custom image. At viewDidAppear, the app confirms that the configuration is in place: navigationBar.standardAppearance.backIndicatorImage is the marker image (B, C), navigationItem.standardAppearance is non-nil (D), and traitCollection.verticalBarEdge is .trailing. This contradicts the guidance given by an Apple Technology Evangelist in https://developer.apple.com/forums/thread/847875: "If you are only replacing the icon on the back button, you could use set the backIndicatorImage and maintain default system behavior. This would be the recommended approach." As things stand, the only way to show a custom back icon in the vertical bar is to replace the system back button with a leading item. That loses the system behavior that comes with it: UINavigationController.interactivePopGestureRecognizer, interactiveContentPopGestureRecognizer and the back-history menu.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
2
Boosts
3
Views
549
Activity
2d
didUpdateEffectiveGeometry reports outer display frame when app is send to background while using the inner display.
On iPhone Duo, when the app goes into background while being used on the inner display, windowScene(_:didUpdateEffectiveGeometry:) is called with a frame matching the geometry of the outer display.  When the app returns to the foreground, the callback fires again with the inner display geometry. We reload our layouts based on this callback so the transient frame cause a visible relayout when returning to the app. This also reproduces when building with Xcode 27.3 beta and on OS version 27.2.0. Snippet: func windowScene(_ windowScene: UIWindowScene, didUpdateEffectiveGeometry previousEffectiveGeometry: UIWindowScene.Geometry) { log("didUpdateEffectiveGeometry", windowScene) } func sceneDidEnterBackground(_ scene: UIScene) { log("sceneDidEnterBackground", scene) } func sceneWillEnterForeground(_ scene: UIScene) { log("sceneWillEnterForeground", scene) } private func log(_ event: String, _ scene: UIScene) { guard let windowScene = scene as? UIWindowScene else { return } let state = windowScene.activationState == .background ? "background" : "foreground" let size = windowScene.effectiveGeometry.coordinateSpace.bounds.size print("\(event) | state: \(state) | size: \(Int(size.width)) x \(Int(size.height))") }Logs: sceneDidEnterBackground | state: background | size: 951 x 669 didUpdateEffectiveGeometry | state: background | size: 466 x 678 <- outer display size, device NOT folded didUpdateEffectiveGeometry | state: background | size: 951 x 669 sceneWillEnterForeground | state: background | size: 951 x 669Is this the expected behaviour, or a known issue? If it’s expected, what’s the recommended way to distinguish the effective geometry change?
Topic: UI Frameworks SubTopic: UIKit
Replies
0
Boosts
0
Views
29
Activity
2d
UITableView row reordering no longer works under macOS 27 with Mac Catalyst
Under macOS 27 using Mac Catalyst for a UIKit-based app, If you present a view controller with a table view as a form sheet or page sheet, row reordering fails to function. You can drag a row as expected but the blue movement bar never appears and if you drop the row it simply returns to its original location. The exact same view controller presented as a popover works just fine. The exact same view controller not presented as a modal (such as the app's root controller) works just fine. This is a serious bug affecting existing applications and being reported by paying customers. This has been reported as FB25038883 which includes a simple sample app demonstrating the issue.
Replies
4
Boosts
1
Views
571
Activity
2d
iPhone Duo Unfolded Safe Areas
Hi, my app is currently built on Xcode 27.1 I am working on upgrading to Xcode 27.2 We have a regression issue whereby, the top safeArea is 82 despite the vertical bar being opted in and active. This only happens on unfolded landscape. Our right safeArea is 0 for the window and is 84 for the view safeArea. Both window and view safeAreas have the top safe area of 82 though. We would like to know what could be the cause behind the top safeArea being activated. Note: this is not an issue for iOS 27.1
Replies
2
Boosts
0
Views
205
Activity
3d
SwiftUI Architecture Guide
Application Types Applications are divided into Document-based and Library-based. A document-based application stores user data in individual, standalone files. Users manually name and organize those files in a local system or synced cloud storage such as iCloud. The software typically opens multiple windows for different projects. This framing is for standalone, complex files that need to be shared, exported, or handled independently. A library-based application manages data in one unified, central repository, locally or through remote cloud databases. Spotify, Netflix, and Notion are the examples shown. The file system is hidden; updates are saved automatically in real time; and a single window supports browsing, search, and access to the synchronized data collection from any device. Model Types Four model types: Data, Domain, Application, and Presentation. Apple Platforms In Apple MVC (AppKit / UIKit), the model branches to Data, Domain, and Presentation. In SwiftUI, Model branches to Data and Domain. Project Structure SwiftUI App Folders Swift Package Folders App Modularization Not every module in a large application needs to be extracted into a separate framework or Swift Package. Logical modularization can also be achieved through a well-organized folder structure within the main project. Introduce separate packages or frameworks only when there is a clear benefit, such as independent reuse, distribution, build isolation or ownership. Avoid unnecessary project and dependency management overhead. State Management & Data Flow Source of truth is “a key concept in SwiftUI”: a single place to store a piece of data, with everywhere else reading the same piece of data. Environment is SwiftUI’s native dependency-injection mechanism. It allows shared dependencies, domain models, and services to be injected at the appropriate view-hierarchy level and accessed where needed without explicit parameter passing or unnecessary coupling. It is described as a tool for managing dependencies and sharing state across the view hierarchy. Domain Model Ownership Domain Models should be owned by the highest relevant SwiftUI view in the hierarchy that defines their context and lifecycle. NavigationStack owns the Domain Models for its navigation context and makes them available to descendant views through @Environment. When a NavigationStack is embedded in a TabView or NavigationSplitView, ownership moves up to the TabView or NavigationSplitView so the models can be shared across tabs or split views. The stated result is clear ownership scope, sharing where needed, and isolation between independent navigation contexts. Previews & UI Testing Environment injection makes SwiftUI Previews and UI Tests easier to configure by allowing real Domain Models to be replaced with mock or dummy instances. Views can be tested independently with controlled data and predictable states, without requiring real services, network requests, or application setup. Domain and Data Model Examples For a library-based app with remote data. Additional Domain Model Examples E-commerce Catalog, ShoppingCart, OrderHistory, Wishlist Banking MyAccounts, MyCards, MyTransactions, MyInvestments Social Network Feed, Conversations, Notifications, Friends Healthcare MyAppointments, MedicalHistory, Prescriptions, MyHealth Education Courses, MyCourses, Assignments, MyGrades, LearningProgress Real Estate PropertyCatalog, MyProperties, Favorites, Appointments Hotel Booking Destinations, Search, MyBookings, TravelHistory Food Delivery RestaurantCatalog, ShoppingCart, MyOrders, DeliveryTracking Project Management Projects, MyTasks, TeamMembers, Notifications Insurance MyPolicies, MyClaims, Coverage, Documents Smart Home MyHomes, Devices, Automations, EnergyUsage Fitness MyPlans, MyProgress, MyGoals, WorkoutHistory Other Search, Dashboard, Favorites, Notifications, Settings, ActivityHistory, Recommendations, Subscription, DocumentLibrary ViewModel? - MVVM In SwiftUI, the View encapsulates the UI content (body), its state (properties), and its actions or tasks (functions). This is possible because SwiftUI is designed around a declarative, state-driven UI model. In Android and .NET platforms, a separate ViewModel is typically required to hold and manage the View's state. Projects that intoduce ViewModels in SwiftUI add unnecessary architectural complexity, boilerplate, and code duplication; synchronization issues; unclear state ownership; additional lifecycle management; more abstractions; harder debugging; and increased maintenance, without meaningful benefits over SwiftUI's native state management. In UIKit, introducing a separate ViewModel layer is often unnecessary, as UIViewController already serves as the presentation model, handling presentation logic and coordinating the view. Non-UI responsibilities can be delegated to dedicated ModelControllers or Managers, avoiding unnecessary layers and abstractions. Domain Models vs. ViewModels Domain Models are view-independent, while ViewModels are view-dependent. A ViewModel is tightly coupled to the structure, state, and lifecycle of a specific View. Whenever the View code changes, its ViewModel often requires corresponding coding changes, and vice versa, creating additional maintenance and synchronization overhead. Domain Models, on the other hand, represent application context and business functionality independently of the UI. This separation preserves UI independence and allows the same Domain Models to be shared across different screens and platforms, such as iPhone, iPhone Duo, iPad, and macOS, without duplicating or adapting business logic for each View. This makes Domain Models a more scalable and maintainable approach for modern SwiftUI applications, particularly those targeting multiple screen sizes and platforms.
Replies
1
Boosts
0
Views
265
Activity
3d
SwiftUI custom focusable view cannot acquire focus programmatically on iPad with a hardware keyboard connected
On iPad, a SwiftUI view using .focusable(interactions: .edit) and .focused($isFocused) cannot acquire focus when a hardware keyboard is already connected. Setting isFocused = true from a button leaves it false. Tapping the view also leaves it unfocused, although the tap is received. Pressing Tab can focus the same view. struct FocusProbeView: View { @FocusState private var isFocused: Bool var body: some View { VStack { Text("Target") .focusable(interactions: .edit) .focused($isFocused) .onTapGesture { print("Target tapped") } Text("isFocused = \(isFocused)") Button("Focus target") { isFocused = true } } .defaultFocus($isFocused, true) } }Steps to reproduce: Run this view on an iPad with a hardware keyboard connected. Tap “Focus target”, then tap “Target”. Observe that isFocused remains false. Press Tab. The target can receive focus through keyboard navigation. Disconnect the keyboard. Restart the app and tap “Focus target” again. isFocused becomes true. Reconnecting the keyboard does not remove that focus. Expected: A visible custom view marked .focusable(interactions: .edit) can receive focus through @FocusState, including when a hardware keyboard is connected. Actual: Programmatic focus fails when the keyboard is already connected. A native TextField tested with the same button and @FocusState does receive focus. Environment: iPad model: MU1V2NF/A; iPadOS version: 26.7.2; Xcode version: 27.2; hardware keyboard: Logi Folio Touch. iPad model: Device Hub iPad Pro 11-inch (M5); iPadOS version: 27.2; Xcode version: 27.2; hardware keyboard: Device Hub.
Replies
1
Boosts
0
Views
230
Activity
3d
Various menu bar NSStatusItem issues with macOS 27
It seems like macOS 27 beta 2 has some issues with NSStatusItem buttons added to the menu bar - this creates difficulties for some menu bar extra apps. NSStatusItem buttons does not receive mouse hover/movement events - FB23329983 On macOS 27, views inside an NSStatusItem button no longer receive hover or mouse-movement events. The same code works correctly on macOS 26. What I tried: An NSTrackingArea attached to a subview of NSStatusBarButton An NSTrackingArea attached directly to the status-bar button Replacing NSStatusItem.view with a custom view Embedding an NSHostingView and using SwiftUI onHover/onContinuousHover NSStatusItem button highlight cannot be set programmatically. - FB23330269 The following code no longer has any effect (does not provide the highlight capsule): NSStatusItem.button?.highlight(true) NSStatusItem window occlusionState no longer reflects hidden menu bar visibility - FB23349447 The following no longer works: statusItem.button?.window?.occlusionState.contains(.visible) These changes may be related to some of the touch related changes or maybe it's about how menu items are now seemingly more "managed" in a way that their position, visibility may change in a way that is transparent/undetectable to the app.
Replies
9
Boosts
2
Views
1.8k
Activity
3d