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

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
Inversed swipe gesture in VStack/LazyVStack vs List
I'm using a row swipe to delete gesture in a LazyVStack just the same way I would do in a List and I have to inverse the gesture (from left to right) to allow the Delete button appearing whereas in a List, the left to right swipe gesture works as expected. The following code reveals that unexpected/anti natural behavior. iOS works as expected for the same code. import SwiftUI import Playgrounds struct ContentView: View { var body: some View { VStack { // anti-natural and inconsistent gesture // LazyVStack { // anti-natural and inconsistent gesture // List { // natural gesture HStack { Text("Swipe Test") Spacer() } .padding(10) .frame(height: 40) .background { Color.blue } .swipeActions(edge: .trailing, allowsFullSwipe: false) { Button("Delete", role: .destructive) {} } } } }Setup: Macbook Pro M1 Max / macOS 27.2.1 / Xcode 27.2
0
0
36
3d
iOS 27: FBSScene crashes in objc_release_x26 after a scene settings update
Feedback Assistant: FB25454822 On iOS 27, our app (com.netshort.abroad) crashes inside FrontBoardServices while releasing an object saved across a synchronous scene-update callout. The stack has only system frames. A build shipped in September 2025 (1.8.3) hits the same crash as soon as the device is updated to iOS 27, so this is not a recent app change. OS: iOS 27.0.0 (24A435), iOS 27.0.1 (24A446) On build 2.3.4: 1264 events, 1216 users 0 libobjc.A.dylib objc_release_x26 + 8 1 FrontBoardServices -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 780 2 FrontBoardServices _queue_updateScene…_block_invoke_2.cold.1 + 352 3 FrontBoardServices _queue_updateScene…_block_invoke_2 + 96 4 FrontBoardServices _calloutQueue_executeCalloutFromSource:withBlock: + 168 On 27.0.0 these frames show as <redacted> in Crashlytics. FrontBoardServices 0x19a88 is this method at 0x1977c plus 780, matching symbolicated 27.0.1 reports. In the 27.0.1 FrontBoardServices binary, +776 is objc_release(x26) and +780 is the return address. x26 is transitionContext.actions. The callout into UIKit is the bl at +0x2ac. The crash happens after that callout returns. 34 Apple crash reports with register state show the same pattern: the low byte of saved x26 is 0x01. 20 reports: objc_release_x26 + 8, x26 = 0x1 14 reports: objc_release_x26 + 16, x26 ends in 0x01 (for example 0x13c373a01) A nil actions value 0x0 becomes 0x1. A real pointer only has its low byte changed, so the isa read is off by one. In the +16 reports, x16 (0x8001000001fa8d89) is that isa shifted by one byte. This looks like a one-byte store of YES into the stack slot where x26 was saved across the callout. There is no single user action that reproduces it. It happens when the system delivers a scene settings update. The frame that wrote the byte is already gone, because the crash is recorded after the callout returns. Has anyone else seen this on iOS 27? I attached three .crash files with full register state to FB25454822.
Topic: UI Frameworks SubTopic: UIKit
1
1
401
4d
A bug in iOS 27.3 beta 2 where the UIHingeInteraction value is received even though it is not an iPhone Duo device.
The device currently showing the symptom is iPhone SE3, iOS 27.3 Beta 2 version installed. (Same symptom exists in Beta 1 as well.) On screen A When switching to another ViewController (screen B) with pushViewController of UINavigationController Declare UIHingeInteraction on screen A and self.view.addInteraction(hInteraction) I added it like the code above. Hinge value comes in. In the sample code below update.hinge value is not nil The update.hinge!.angle value is also displayed as 0. let hInteraction:UIHingeInteraction = UIHingeInteraction { interaction, update in if update.hinge != nil { let hingeAngle:CGFloat = update.hinge!.angle..... }} In apps installed on other iPhone 17 devices (with iOS 27.2 installed), the value does not appear there. A quick fix is ​​needed. I have also submitted a report via Apple Feedback; please ensure this is addressed in the upcoming Beta 3 release. *** Plus *** The horizontalSizeClass and verticalSizeClass properties are returning "Regular" values, similar to how they behave on the iPhone Duo's internal display. Please fix the above issue as well.
0
0
118
4d
Supported way to hide the system time in a full-screen watchOS clock app?
I'm building a standalone watchOS app (SwiftUI, watch-only) whose main screen is its own full-screen clock. The system time in the top-right corner duplicates our clock, so we'd like to hide it while this view is visible. I'd like to know which API is supported for this in an App Store app. What I tried (watchOS 27.2 SDK, Xcode 27.2): .persistentSystemOverlays(.hidden) on the root view and on the scene. The system time stays visible. In a variant with a NavigationStack and a hidden navigation bar, the time was briefly absent after launch, but it came back within about 20 seconds. .statusBarHidden(_:) and .toolbarVisibility(.hidden, for: .statusBar) are marked unavailable on watchOS in the SDK. View._statusBarHidden(_:) hides the system time reliably. In the watchOS SwiftUI interface it is public, available on watchOS since 6.0, and has no @_spi. It inlines to _statusBar(hidden:). However, it's underscored and I can't find documentation for it. Minimal example: struct ClockView: View { var body: some View { MyFullScreenClock() .persistentSystemOverlays(.hidden) // documented, but time remains visible ._statusBarHidden(true) // hides the time, but undocumented } }I've noticed this modifier in shipping open-source watchOS code, for example Home Assistant's watch app (Sources/WatchApp/Home/WatchHomeView.swift). That doesn't tell me whether Apple supports it, though. Questions: Is _statusBarHidden(_:) / _statusBar(hidden:) a supported API for a distributed watchOS app? If not, is there a documented way for a full-screen clock app to hide the system time, or is the system time intentionally always shown in third-party apps? I can share a small sample project that toggles between the documented overlay preference and the underscored modifier. Thanks!
2
0
89
4d
UIDesignRequiresCompatibility = YES causes a crash on iOS 26 when built with Xcode 27. The key seems to follow the runtime OS, not the build SDK
Hi, I ran into a behavior of UIDesignRequiresCompatibility that doesn't match how I (and probably others) read the documentation. Environment Xcode: 27.2 Base SDK: iOS 27.2 Deployment target: iOS 18 Run destination: iOS 26.6 (physical device) Documentation The documentation states: "The system ignores this key when you build for iOS 27 or later, iPadOS 27 or later, Mac Catalyst 27 or later, macOS 27 or later, or tvOS 27 or later." I read "build for iOS 27" as a build-time condition: once the app is built with the iOS 27 SDK, the key no longer has any effect, whatever OS the app runs on. What I observed With UIDesignRequiresCompatibility = YES in Info.plist, I built the app against the iOS 27 SDK and ran it on iOS 26.6. The app crashes at launch. I removed only that key, did a clean build with the same configuration, and ran on the same iOS 26.6 device. The app runs normally. So in practice the key is not ignored for an app built for iOS 27. It looks like the decision is made by the OS the app runs on: iOS 27+ ignores the key, but iOS 26 still reads and applies it to a binary linked against the iOS 27 SDK, and that combination crashes. Questions What does "build for iOS 27 or later" refer to: the SDK the app is built with, the deployment target, or the OS the app runs on? My deployment target is iOS 18, so the app still runs on iOS 26. If the key is still honored there even when the app is built with the iOS 27 SDK, could the documentation say so explicitly? Is compatibility mode on iOS 26 for an app linked against the iOS 27 SDK an unsupported combination, and is the crash expected? Should developers simply remove the key when they adopt the iOS 27 SDK and still support iOS 26? Thanks!
Topic: UI Frameworks SubTopic: General Tags:
0
0
106
4d
iPhone Duo: Keep app on inner display while hinge is open (like Clock)?
I'm building a night-light app for iPhone Duo. When the device is partly open in tent mode, the lamp starts on the inner display. As soon as I set the phone down on a table, the system moves my window to the outer display, even though the hinge stays open. Apple's Clock app stays on the inner display in the same pose, so it seems possible at the system level. Steps Open iPhone Duo to ~80° (tent). Launch the app on the inner display. Set the device down on a table. Observed (logged from the app) UIHinge.status stays .partiallyOpen (~80°), not .closed. UIDevice.orientation goes portraitUpsideDown → faceDown → landscapeRight. UIScreen.didDisconnectNotification fires and UIScreen.screens drops the inner screen. The window moves to the outer screen (466×678). What I've tried Restricting UISupportedInterfaceOrientations to portrait only Turning on Rotation Lock Reading UIHingeInteraction (read-only, no effect on display routing) Looking at UISceneAccessory.cameraCapture, which only applies with an active capture session and a fully open device Question Is there a supported way for a scene to prefer or stay on the inner display while the hinge isn't closed? If not, I'll file a Feedback Assistant request. iPhone Duo · iOS 27.2 · Xcode 27.2
Topic: UI Frameworks SubTopic: SwiftUI
2
0
89
5d
iOS 27b3 SDK: iOS App on Mac crashes on UISearchBar focus
Our app crashes when compiled with the iOS 27 beta 3 SDK and run as an iOS app on Mac, on both macOS 26 and macOS 27, as soon as a UISearchBar receives focus. The crash is due to this exception: *** Assertion failure in BOOL _screenBasedFocusUnsupported(void)(), UIScreen.m:3.725 Accessing the focus system through UIScreen is no longer supported. ( 0 CoreFoundation 0x000000018bea31c0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000018b91e91c objc_exception_throw + 88 2 Foundation 0x000000018e092644 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0 3 UIKitCore 0x00000001c5dae8ec _screenBasedFocusUnsupported + 272 4 UIKitCore 0x00000001c5dae960 -[UIScreen _preferredFocusedWindow] + 24 5 UIKitCore 0x00000001c4ea3a60 -[UIScreen _mainSceneReferenceBounds] + 200 6 UIKitCore 0x00000001c4ea3914 -[UIScreen _mainSceneBoundsForInterfaceOrientation:] + 40 7 UIKitCore 0x00000001c5708134 +[UINavigationBar defaultSizeForOrientation:] + 76 8 UIKitCore 0x00000001c6222c88 -[_UISearchPresentationController _layoutPresentationWithSize:transitionCoordinator:] + 704 9 UIKitCore 0x00000001c622296c -[_UISearchPresentationController containerViewWillLayoutSubviews] + 84 10 UIKitCore 0x00000001c549304c block_destroy_helper.13 + 25112 11 UIKitCore 0x00000001c549344c block_destroy_helper.13 + 26136 12 UIKitCore 0x00000001c4ea26a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1648 13 QuartzCore 0x0000000196103dbc _ZN2CA5Layer15perform_update_EPS0_P7CALayerjNS_17LayerUpdateReasonEPNS_11TransactionE + 460 14 QuartzCore 0x000000019610390c _ZN2CA5Layer17update_if_needed_EPNS_11TransactionENS_17LayerUpdateReasonE + 692 15 QuartzCore 0x0000000196035d2c _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 608 16 QuartzCore 0x0000000195e69520 _ZN2CA11Transaction6commitEv + 652 17 AppKit 0x0000000190fe116c __37+[NSDisplayCycle currentDisplayCycle]_block_invoke.7 + 44 18 CoreFoundation 0x000000018be34ad0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28 19 CoreFoundation 0x000000018be34a10 __CFRunLoopDoBlocks + 396 20 CoreFoundation 0x000000018be33e54 __CFRunLoopRun + 2356 21 CoreFoundation 0x000000018bf06234 _CFRunLoopRunSpecificWithOptions + 532 22 HIToolbox 0x0000000198c1f560 RunCurrentEventLoopInMode + 320 23 HIToolbox 0x0000000198c228bc ReceiveNextEventCommon + 488 24 HIToolbox 0x0000000198dac14c _BlockUntilNextEventMatchingListInMode + 48 25 AppKit 0x00000001909163d0 _DPSBlockUntilNextEventMatchingListInMode + 228 26 AppKit 0x000000019026a084 _DPSNextEvent + 576 27 AppKit 0x0000000190dff96c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 28 AppKit 0x0000000190dff678 -[NSApplication(NSEventRouting) nextEventMatchingMask:untilDate:inMode:dequeue:] + 72 29 AppKit 0x000000019025d13c -[NSApplication run] + 368 30 AppKit 0x00000001902357b0 NSApplicationMain + 880 31 AppKit 0x000000019047c958 +[NSWindow _savedFrameFromString:] + 0 32 UIKitMacHelper 0x00000001aa2651bc UINSApplicationMain + 972 33 UIKitCore 0x00000001c4e1aed4 UIApplicationMain + 144 34 UIKitCore 0x00000001c548bda0 block_destroy_helper.31 + 8880 35 DigitalConcertHall.debug.dylib 0x0000000106e41bd8 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 128 36 DigitalConcertHall.debug.dylib 0x0000000106e41b4c $s18DigitalConcertHall11AppDelegateC5$mainyyFZ + 32 37 DigitalConcertHall.debug.dylib 0x0000000106e4afc0 __debug_main_executable_dylib_entry_point + 28 38 dyld 0x000000018b9ac4e4 start + 6992 ) I could not test with the iOS 27 beta 4 SDK due to this blocking issue: https://developer.apple.com/forums/thread/839012 However, when I tried to set up a simple sample project, I could not reproduce the issue. Does anybody know what might be causing this? I filed feedback FB24201508
8
2
2.1k
5d
Keeping the display awake during hands-free auto-scroll in a watchOS reading app
I develop Folito, a free watchOS app for reading EPUB books on Apple Watch. We added an auto-scroll mode: the text scrolls continuously at a speed the user sets with the Digital Crown, so they can read hands-free with their wrist raised. The display dims after the wake timeout because auto-scroll isn't user interaction, so the text becomes hard to read after 15–70 seconds while the user is still reading. What we've considered Pausing on isLuminanceReduced and resuming on tap. This works, but it needs a touch every minute. Continuing in Always On (luminance reduced) with ~1 Hz line-by-line updates. This is our current plan, but the text is dimmed and SE models have no Always On. WKExtendedRuntimeSession. None of the session types (self care, mindfulness, physical therapy, smart alarm, workout) describes reading, and we don't want to misuse one. HKWorkoutSession. Not appropriate, because it would record fake workouts. Questions Is there a supported way for a frontmost app to keep the display at normal brightness while showing continuously changing content the user is reading, without touch input? Would a WKExtendedRuntimeSession started only while auto-scroll runs (and ended as soon as it pauses or stops) be acceptable for this, and if so, which type? In Always On, what's the recommended way to keep text content advancing (for example, updating a ScrollView position via ScrollViewReader about once per second)? I found thread 720495 (iOS, isIdleTimerDisabled) and thread 122753 (Always On, 2019), but neither covers a watchOS app that needs the display awake while content advances on its own. Deployment target: watchOS 10, SwiftUI. Thanks!
1
0
271
5d
UIWindowScene sizeRestrictions minimumSize not working on iPadOS
Hello, following Apple docs and guidance from WWDC I'm trying to set a minimum size for my scene, for example I want it to minimally be 3/4 the width and height of the device. I've removed the UIRequiresFullScreen Info.plist property. The app does run in windowed mode and does have a resizing handle. I've implemented this UISceneDelegate: var window: UIWindow? var cameraWindow: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window = UIWindow(windowScene: scene as! UIWindowScene) // setup root view controller let rootViewController: MainViewController = MainViewController(nibName: "Main", bundle: nil) let navController: NavigationController = NavigationController(rootViewController: rootViewController) navController.modalPresentationStyle = .fullScreen // set reasonable minimum sizes for WindowScene if let windowScene: UIWindowScene = scene as? UIWindowScene { if #available(iOS 16.0, *) { let windowSize: CGSize = windowScene.coordinateSpace.bounds.size windowScene.sizeRestrictions?.minimumSize.width = windowSize.width * 0.75 windowScene.sizeRestrictions?.minimumSize.height = windowSize.height * 0.75 } } window?.rootViewController = navController window?.makeKeyAndVisible() } } And proven via debugger that this code is being executed. I have the following observations: After setting these minimumSize properties I see the width and height both contain 0 afterwards, as if the property settings are discarding the value. I've even used hard-coded values instead of reading the coordinateSpace.bounds, to no avail. The scene is allowing resizing well below these minimums, about 1/3 the width and 1/2 the height. Anyone else observed this and have suggestions?
Topic: UI Frameworks SubTopic: UIKit
1
1
372
5d
Can I use a template image for quick actions?
Hey Team, System-provided quick actions in Finder sport a template image that adapts correctly to light and dark modes. However when I add a quick action extension in my app, the icon I refer to in the Info.plist renders in full color, even if it is defined in the asset catalog as a template image. This forces me to either use my app icon or a gray icon that will work in either appearance. How can I get the system-provided quick actions treatment? Thanks, Ari
Topic: UI Frameworks SubTopic: AppKit
2
1
320
6d
NavigationSplitView sidebar expansion temporarily oversizes split view and collapses toolbar search
[Submitted as FB25597038] Showing the sidebar in a two-column NavigationSplitView briefly collapses the toolbar search field, even though the window doesn't resize. Search is right-aligned on the detail container using .searchable, ToolbarSpacer(.flexible), and DefaultToolbarItem(kind: .search). The sample below uses static content and the native sidebar toggle and animation. Setting only the sidebar item's collapseBehavior to .useConstraints avoids the issue. It occurred in both recorded baseline expansions and neither expansion with the workaround. Environment macOS 27.2.1 (26B131) Xcode 27.2 (27B52) macOS SDK 27.2 (26B118) Native macOS app, arm64, deployment target macOS 27.0 Initial window: 906 × 600 points Sidebar minimum/ideal/maximum widths: 180/240/360 points Repro Create a new macOS App project named SidebarAnimationRepro, using SwiftUI and Swift. Set the deployment target to macOS 27.0. Replace SidebarAnimationReproApp.swift and ContentView.swift with the code below. Leave usesWorkaround set to false. Build and run. Keep the initial 906-point window width. Click Hide Sidebar and let the transition settle. Click Show Sidebar and watch the search field during expansion. Stop the app, change usesWorkaround to true, and run again. Repeat steps 4–5 to compare the behavior. Expected The split view should stay within the window during sidebar expansion. The search field should stay visible at its normal width without briefly collapsing or disappearing. Actual The split view temporarily grows to 1,146 points while the window stays 906 points wide. Search shrinks from 325 to 36 points and disappears, then returns to its normal size and visibility. The toolbar, search item, and search field remain the same instances, and toolbar item order doesn't change. In one capture, search collapsed about 123 ms after expansion started, returned at 274 ms, and the split view settled at 283 ms. With .useConstraints, the split view stayed at 906 points and search stayed visible at 325 points throughout both hide/show cycles. Screenshots Three frames before, during, and after the sidebar expansion: Sample Code SidebarAnimationReproApp.swift import SwiftUI @main struct SidebarAnimationReproApp: App { var body: some Scene { WindowGroup("Sidebar Animation Repro") { ContentView() } .defaultSize(width: 906, height: 600) } }ContentView.swift import AppKit import SwiftUI struct ContentView: View { @State private var searchText = "" var body: some View { NavigationSplitView { List { Label("Example", systemImage: "folder") } .navigationSplitViewColumnWidth(min: 180, ideal: 240, max: 360) } detail: { Text("Synthetic detail content") .frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity) .background { SplitViewAttachment() } .searchable(text: $searchText, placement: .toolbar) .toolbar { ToolbarSpacer(.flexible) DefaultToolbarItem(kind: .search) } } .toolbar(removing: .title) .frame(minWidth: 720, minHeight: 420) } } struct SplitViewAttachment: NSViewRepresentable { func makeNSView(context: Context) -> Attachment { Attachment() } func updateNSView(_ view: Attachment, context: Context) { view.applyWorkaround() } final class Attachment: NSView { private let usesWorkaround = false override func hitTest(_ point: NSPoint) -> NSView? { nil } override func viewDidMoveToWindow() { super.viewDidMoveToWindow() applyWorkaround() } /// The split controller can enter the responder chain after the view enters its window. override func layout() { super.layout() applyWorkaround() } fileprivate func applyWorkaround() { guard usesWorkaround, window != nil else { return } let responders = sequence(first: self as NSResponder, next: \.nextResponder) guard let controller = responders.first(where: { $0 is NSSplitViewController }) as? NSSplitViewController, let sidebar = controller.splitViewItems.first(where: { $0.behavior == .sidebar }), sidebar.collapseBehavior != .useConstraints else { return } sidebar.collapseBehavior = .useConstraints } } }
0
0
50
6d
@FocusedValue from .focusedSceneValue from the Scene Commands
Hi, In iPadOS can we use a .focusedSceneValue, defined from a command/Button inside a Scene, from inside the .command modifier attached to the scene? Like this: @main struct test_focusedSceneValueApp: App {     var body: some Scene {         WindowGroup {             ContentView()         }         .commands {             NavigationCommands()         }     } } struct NavigationCommands: Commands {     @FocusedValue(\.filterAction) var filterAction     var body: some Commands {         CommandMenu("Navigate") {             Button("Test focusedSceneValue") {                 filterAction?()             }             .keyboardShortcut("5")         }     } } struct ContentView: View {     @FocusState var isFiltering: Bool     @State private var focusField: String = "teste field teste"     var body: some View {         TextField("teste focus", text: $focusField)             .focused($isFiltering)             .focusedSceneValue(\.filterAction) {                 print("test successful")                 isFiltering = true             }     } This code is almost the same from the sample code from the documentation, however I can only retrieved nil values from the @FocusedValue and not the defined value. Thanks.
5
0
2.2k
1w
Article Accelerator tutorial: “Dissecting an app’s architecture” doesn’t explain data flow, and ArticleStore isn’t a realistic network simulation
Here's a sharper version. It's blunt about how badly the app is built, but it avoids swearing and insults, because forum moderators remove posts like that. Title: Article Accelerator: an architecture tutorial built on patterns we shouldn't copy Text: The tutorial "Dissecting an app's architecture" promises to show how data flows in and through Article Accelerator: https://developer.apple.com/tutorials/app-dev-training/dissecting-an-apps-architecture For a tutorial whose whole subject is architecture, the sample app is a poor example of it. The article never actually traces the data flow, and the code it describes uses patterns that most SwiftUI guidance tells you to avoid. The "simulated network service" isn't one. The tutorial says ArticleStore simulates a network service. In reality it's a singleton that synchronously loads JSON files from the bundle. It can't be slow, can't fail and can't return partial data, so it simulates none of what makes networking hard. It cannot be turned into an async URLSession call without throwing it away and redesigning the data layer. Views fetch data directly from a singleton. DetailView does private let articles = ArticleStore.shared.articles() as a stored property. There's no @Observable model, no loading state, no error state, and no dependency injection. This makes the views impossible to test with fake data and hides the data flow the tutorial claims to explain. Error handling is print and fatalError. A broken article file is silently skipped with print. An unreadable folder crashes the app. Failing to delete user data also crashes the app. SwiftData setup is inconsistent. The app creates one ModelContainer, then ArticleStateManager creates a separate ModelContext instead of using the container's mainContext. So writes through the manager and @Query reads go through different contexts. On top of that, the environment default for articleStateManager quietly creates a second ModelContainer with try!, so any window that forgets to inject it gets a different container. The structure isn't structured. The tutorial's challenge asks you to sort the Models folder into three categories, but the project puts everything in one flat folder, including ArticleStateManager, which isn't a model at all. Article, the main model, isn't even in it. The key design decision is never explained. Articles live only in memory while user data lives in SwiftData, and views join them by ID. That's a reasonable split, but the tutorial never says so, never explains why, and never addresses what it means for offline support, caching or paging. A learner who expects "fetch, store in SwiftData, show with @Query" is left confused. Official Apple tutorials are where many developers learn what good practice looks like. An article called "Dissecting an app's architecture" should either show a sound architecture, or clearly label the shortcuts as shortcuts. Right now it does neither. My questions: Is ArticleStore intended as a pattern to follow, or only a placeholder? What would Apple recommend for this app's data layer with a real async network service, including caching and paging?
0
0
163
1w
.bottomBar toolbar item missing after rotation in NavigationSplitView on iOS 26 (Regular width / compact height)
A ToolbarItem(placement: .bottomBar) inside a NavigationSplitView detail/destination view is missing after a device rotation on iOS 26. The bottom toolbar is missing until the view has been presented in both orientations, after which it renders correctly from then on. The issue does not reproduce on iOS 18. Environment iOS 26 only — does not reproduce on iOS 18 iPhone 17 Pro Max and iPhone 17 Air (i.e. devices that expose the landscape size class Regular width / compact height) SwiftUI NavigationSplitView with .balanced style Steps to reproduce Run the sample below on an iPhone 17 Pro Max or Air (or a simulator of either). Open the detail view (which contains a .bottomBar toolbar item) while the device is in either orientation. Rotate the device. Observe that the bottom toolbar is now missing. Expected behavior The .bottomBar button remains visible across rotation, regardless of which orientation the view was first presented in. Actual behavior On first presentation, rotating the device causes the bottom toolbar to disappear. Once the view has been presented in both landscape and portrait (roughly the third presentation), the bottom bar renders correctly and continues to behave correctly afterward. The behavior is inconsistent import SwiftUI @main struct MinimumReproducibleEventApp: App { var body: some Scene { WindowGroup { NavigationSplitView(columnVisibility: .constant(.all)) { NavigationLink("Primary") { ContentView() } } detail: { Text("Hello") } .navigationSplitViewStyle(.balanced) } } } ContentView import SwiftUI struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .toolbar { ToolbarItem(placement: .bottomBar) { Button("Hello") { print("hello") } } } } }
Topic: UI Frameworks SubTopic: SwiftUI
7
2
595
1w
PhotosPicker selection badges initially appear blue, then change to the correct tint after backgrounding
Hello Apple Developer Team, I’m developing an iOS camera app called 1/250 using SwiftUI and the system photo picker (PhotosPicker). I’ve encountered an issue where the photo picker’s selection badge colors are inconsistent between the initial presentation and returning from the background. Steps to Reproduce 1. Open the app and present PhotosPicker. 2. Select multiple photos. 3. The numbered selection badges (1, 2, 3, etc.) appear in the default system blue, despite the app using yellow as its accent color. 4. Send the app to the background without dismissing PhotosPicker. 5. Return to the app. 6. The same selection badges now appear in the correct yellow color. Expected Behavior The numbered selection badges should use the app’s yellow tint color consistently, including when PhotosPicker is first presented. Actual Behavior * Initial presentation: Blue selection badges. * After backgrounding and returning: Yellow selection badges. * No changes to the selected photos or app settings are required. Questions 1. Is this a known issue with SwiftUI PhotosPicker or its underlying UIKit implementation? 2. Why would the tint color be applied correctly only after the app returns from the background? 3. Is there a recommended way to ensure the correct tint is applied before the picker is first displayed? 4. Is there an Apple-supported workaround that avoids recreating or replacing the system photo picker? I would prefer to continue using Apple’s native PhotosPicker rather than implementing a custom photo selection interface. Any guidance from Apple engineers would be greatly appreciated. Thank you!
Topic: UI Frameworks SubTopic: SwiftUI
0
0
140
1w
macOS 27 has a bit laggier menus than recent macOS versions. Can that be improved?
While not always too obvious there is sometimes delay or ”hiccup” when moving the arrow pointer horizontally among the menus for an app in top left of the menu bar. This feels like a regression from previous macOS versions. I hope this will improve in fuiture macOS 27 updates as it adds a bit of friction in the user interface experience. Wanted to add a video, but since only images seem supported to upload I might link to it later.
Topic: UI Frameworks SubTopic: General
1
0
105
1w
How to disable a custom detent in a UISheetPresentationController
If you are creating a UISheetPresentationController with custom detents and you have a need to disable one of the detents, then you can do so by returning a special value from the detent's resolver. This is addressed in the Objective-C documentation for customDetentWithIdentifier:resolver:. You return the special value UISheetPresentationControllerDetentInactive. For example: UISheetPresentationControllerDetent *customDetent = [UISheetPresentationControllerDetent customDetentWithIdentifier:@"customId" resolver:^CGFloat(id<UISheetPresentationControllerDetentResolutionContext> _Nonnull context) { if (some condition) { return UISheetPresentationControllerDetentInactive; } else { return context.maximumDetentValue / 3.0; } }];However, if you wish to do this in Swift, there is no corresponding API for UISheetPresentationControllerDetentInactive. It turns out that you can just use .greatestFiniteMagnitude instead. For example: let customDetent = UISheetPresentationController.Detent.custom(identifier: .init("customId")) { context in if some condition { return .greatestFiniteMagnitude //UISheetPresentationControllerDetentInactive } else { return context.maximumDetentValue / 3.0 } }It might be tempting to add the following: extension UISheetPresentationController.Detent { static let Inactive = CGFloat.greatestFiniteMagnitude }but this could cause a conflict if Apple adds a similar API in the future. This oversight in the Swift API has been reported as FB25567661.
1
0
126
1w
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
Inversed swipe gesture in VStack/LazyVStack vs List
I'm using a row swipe to delete gesture in a LazyVStack just the same way I would do in a List and I have to inverse the gesture (from left to right) to allow the Delete button appearing whereas in a List, the left to right swipe gesture works as expected. The following code reveals that unexpected/anti natural behavior. iOS works as expected for the same code. import SwiftUI import Playgrounds struct ContentView: View { var body: some View { VStack { // anti-natural and inconsistent gesture // LazyVStack { // anti-natural and inconsistent gesture // List { // natural gesture HStack { Text("Swipe Test") Spacer() } .padding(10) .frame(height: 40) .background { Color.blue } .swipeActions(edge: .trailing, allowsFullSwipe: false) { Button("Delete", role: .destructive) {} } } } }Setup: Macbook Pro M1 Max / macOS 27.2.1 / Xcode 27.2
Replies
0
Boosts
0
Views
36
Activity
3d
iOS 27: FBSScene crashes in objc_release_x26 after a scene settings update
Feedback Assistant: FB25454822 On iOS 27, our app (com.netshort.abroad) crashes inside FrontBoardServices while releasing an object saved across a synchronous scene-update callout. The stack has only system frames. A build shipped in September 2025 (1.8.3) hits the same crash as soon as the device is updated to iOS 27, so this is not a recent app change. OS: iOS 27.0.0 (24A435), iOS 27.0.1 (24A446) On build 2.3.4: 1264 events, 1216 users 0 libobjc.A.dylib objc_release_x26 + 8 1 FrontBoardServices -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 780 2 FrontBoardServices _queue_updateScene…_block_invoke_2.cold.1 + 352 3 FrontBoardServices _queue_updateScene…_block_invoke_2 + 96 4 FrontBoardServices _calloutQueue_executeCalloutFromSource:withBlock: + 168 On 27.0.0 these frames show as <redacted> in Crashlytics. FrontBoardServices 0x19a88 is this method at 0x1977c plus 780, matching symbolicated 27.0.1 reports. In the 27.0.1 FrontBoardServices binary, +776 is objc_release(x26) and +780 is the return address. x26 is transitionContext.actions. The callout into UIKit is the bl at +0x2ac. The crash happens after that callout returns. 34 Apple crash reports with register state show the same pattern: the low byte of saved x26 is 0x01. 20 reports: objc_release_x26 + 8, x26 = 0x1 14 reports: objc_release_x26 + 16, x26 ends in 0x01 (for example 0x13c373a01) A nil actions value 0x0 becomes 0x1. A real pointer only has its low byte changed, so the isa read is off by one. In the +16 reports, x16 (0x8001000001fa8d89) is that isa shifted by one byte. This looks like a one-byte store of YES into the stack slot where x26 was saved across the callout. There is no single user action that reproduces it. It happens when the system delivers a scene settings update. The frame that wrote the byte is already gone, because the crash is recorded after the callout returns. Has anyone else seen this on iOS 27? I attached three .crash files with full register state to FB25454822.
Topic: UI Frameworks SubTopic: UIKit
Replies
1
Boosts
1
Views
401
Activity
4d
A bug in iOS 27.3 beta 2 where the UIHingeInteraction value is received even though it is not an iPhone Duo device.
The device currently showing the symptom is iPhone SE3, iOS 27.3 Beta 2 version installed. (Same symptom exists in Beta 1 as well.) On screen A When switching to another ViewController (screen B) with pushViewController of UINavigationController Declare UIHingeInteraction on screen A and self.view.addInteraction(hInteraction) I added it like the code above. Hinge value comes in. In the sample code below update.hinge value is not nil The update.hinge!.angle value is also displayed as 0. let hInteraction:UIHingeInteraction = UIHingeInteraction { interaction, update in if update.hinge != nil { let hingeAngle:CGFloat = update.hinge!.angle..... }} In apps installed on other iPhone 17 devices (with iOS 27.2 installed), the value does not appear there. A quick fix is ​​needed. I have also submitted a report via Apple Feedback; please ensure this is addressed in the upcoming Beta 3 release. *** Plus *** The horizontalSizeClass and verticalSizeClass properties are returning "Regular" values, similar to how they behave on the iPhone Duo's internal display. Please fix the above issue as well.
Replies
0
Boosts
0
Views
118
Activity
4d
Supported way to hide the system time in a full-screen watchOS clock app?
I'm building a standalone watchOS app (SwiftUI, watch-only) whose main screen is its own full-screen clock. The system time in the top-right corner duplicates our clock, so we'd like to hide it while this view is visible. I'd like to know which API is supported for this in an App Store app. What I tried (watchOS 27.2 SDK, Xcode 27.2): .persistentSystemOverlays(.hidden) on the root view and on the scene. The system time stays visible. In a variant with a NavigationStack and a hidden navigation bar, the time was briefly absent after launch, but it came back within about 20 seconds. .statusBarHidden(_:) and .toolbarVisibility(.hidden, for: .statusBar) are marked unavailable on watchOS in the SDK. View._statusBarHidden(_:) hides the system time reliably. In the watchOS SwiftUI interface it is public, available on watchOS since 6.0, and has no @_spi. It inlines to _statusBar(hidden:). However, it's underscored and I can't find documentation for it. Minimal example: struct ClockView: View { var body: some View { MyFullScreenClock() .persistentSystemOverlays(.hidden) // documented, but time remains visible ._statusBarHidden(true) // hides the time, but undocumented } }I've noticed this modifier in shipping open-source watchOS code, for example Home Assistant's watch app (Sources/WatchApp/Home/WatchHomeView.swift). That doesn't tell me whether Apple supports it, though. Questions: Is _statusBarHidden(_:) / _statusBar(hidden:) a supported API for a distributed watchOS app? If not, is there a documented way for a full-screen clock app to hide the system time, or is the system time intentionally always shown in third-party apps? I can share a small sample project that toggles between the documented overlay preference and the underscored modifier. Thanks!
Replies
2
Boosts
0
Views
89
Activity
4d
UIDesignRequiresCompatibility = YES causes a crash on iOS 26 when built with Xcode 27. The key seems to follow the runtime OS, not the build SDK
Hi, I ran into a behavior of UIDesignRequiresCompatibility that doesn't match how I (and probably others) read the documentation. Environment Xcode: 27.2 Base SDK: iOS 27.2 Deployment target: iOS 18 Run destination: iOS 26.6 (physical device) Documentation The documentation states: "The system ignores this key when you build for iOS 27 or later, iPadOS 27 or later, Mac Catalyst 27 or later, macOS 27 or later, or tvOS 27 or later." I read "build for iOS 27" as a build-time condition: once the app is built with the iOS 27 SDK, the key no longer has any effect, whatever OS the app runs on. What I observed With UIDesignRequiresCompatibility = YES in Info.plist, I built the app against the iOS 27 SDK and ran it on iOS 26.6. The app crashes at launch. I removed only that key, did a clean build with the same configuration, and ran on the same iOS 26.6 device. The app runs normally. So in practice the key is not ignored for an app built for iOS 27. It looks like the decision is made by the OS the app runs on: iOS 27+ ignores the key, but iOS 26 still reads and applies it to a binary linked against the iOS 27 SDK, and that combination crashes. Questions What does "build for iOS 27 or later" refer to: the SDK the app is built with, the deployment target, or the OS the app runs on? My deployment target is iOS 18, so the app still runs on iOS 26. If the key is still honored there even when the app is built with the iOS 27 SDK, could the documentation say so explicitly? Is compatibility mode on iOS 26 for an app linked against the iOS 27 SDK an unsupported combination, and is the crash expected? Should developers simply remove the key when they adopt the iOS 27 SDK and still support iOS 26? Thanks!
Topic: UI Frameworks SubTopic: General Tags:
Replies
0
Boosts
0
Views
106
Activity
4d
iPhone Duo: Keep app on inner display while hinge is open (like Clock)?
I'm building a night-light app for iPhone Duo. When the device is partly open in tent mode, the lamp starts on the inner display. As soon as I set the phone down on a table, the system moves my window to the outer display, even though the hinge stays open. Apple's Clock app stays on the inner display in the same pose, so it seems possible at the system level. Steps Open iPhone Duo to ~80° (tent). Launch the app on the inner display. Set the device down on a table. Observed (logged from the app) UIHinge.status stays .partiallyOpen (~80°), not .closed. UIDevice.orientation goes portraitUpsideDown → faceDown → landscapeRight. UIScreen.didDisconnectNotification fires and UIScreen.screens drops the inner screen. The window moves to the outer screen (466×678). What I've tried Restricting UISupportedInterfaceOrientations to portrait only Turning on Rotation Lock Reading UIHingeInteraction (read-only, no effect on display routing) Looking at UISceneAccessory.cameraCapture, which only applies with an active capture session and a fully open device Question Is there a supported way for a scene to prefer or stay on the inner display while the hinge isn't closed? If not, I'll file a Feedback Assistant request. iPhone Duo · iOS 27.2 · Xcode 27.2
Topic: UI Frameworks SubTopic: SwiftUI
Replies
2
Boosts
0
Views
89
Activity
5d
iOS 27b3 SDK: iOS App on Mac crashes on UISearchBar focus
Our app crashes when compiled with the iOS 27 beta 3 SDK and run as an iOS app on Mac, on both macOS 26 and macOS 27, as soon as a UISearchBar receives focus. The crash is due to this exception: *** Assertion failure in BOOL _screenBasedFocusUnsupported(void)(), UIScreen.m:3.725 Accessing the focus system through UIScreen is no longer supported. ( 0 CoreFoundation 0x000000018bea31c0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000018b91e91c objc_exception_throw + 88 2 Foundation 0x000000018e092644 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0 3 UIKitCore 0x00000001c5dae8ec _screenBasedFocusUnsupported + 272 4 UIKitCore 0x00000001c5dae960 -[UIScreen _preferredFocusedWindow] + 24 5 UIKitCore 0x00000001c4ea3a60 -[UIScreen _mainSceneReferenceBounds] + 200 6 UIKitCore 0x00000001c4ea3914 -[UIScreen _mainSceneBoundsForInterfaceOrientation:] + 40 7 UIKitCore 0x00000001c5708134 +[UINavigationBar defaultSizeForOrientation:] + 76 8 UIKitCore 0x00000001c6222c88 -[_UISearchPresentationController _layoutPresentationWithSize:transitionCoordinator:] + 704 9 UIKitCore 0x00000001c622296c -[_UISearchPresentationController containerViewWillLayoutSubviews] + 84 10 UIKitCore 0x00000001c549304c block_destroy_helper.13 + 25112 11 UIKitCore 0x00000001c549344c block_destroy_helper.13 + 26136 12 UIKitCore 0x00000001c4ea26a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1648 13 QuartzCore 0x0000000196103dbc _ZN2CA5Layer15perform_update_EPS0_P7CALayerjNS_17LayerUpdateReasonEPNS_11TransactionE + 460 14 QuartzCore 0x000000019610390c _ZN2CA5Layer17update_if_needed_EPNS_11TransactionENS_17LayerUpdateReasonE + 692 15 QuartzCore 0x0000000196035d2c _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 608 16 QuartzCore 0x0000000195e69520 _ZN2CA11Transaction6commitEv + 652 17 AppKit 0x0000000190fe116c __37+[NSDisplayCycle currentDisplayCycle]_block_invoke.7 + 44 18 CoreFoundation 0x000000018be34ad0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28 19 CoreFoundation 0x000000018be34a10 __CFRunLoopDoBlocks + 396 20 CoreFoundation 0x000000018be33e54 __CFRunLoopRun + 2356 21 CoreFoundation 0x000000018bf06234 _CFRunLoopRunSpecificWithOptions + 532 22 HIToolbox 0x0000000198c1f560 RunCurrentEventLoopInMode + 320 23 HIToolbox 0x0000000198c228bc ReceiveNextEventCommon + 488 24 HIToolbox 0x0000000198dac14c _BlockUntilNextEventMatchingListInMode + 48 25 AppKit 0x00000001909163d0 _DPSBlockUntilNextEventMatchingListInMode + 228 26 AppKit 0x000000019026a084 _DPSNextEvent + 576 27 AppKit 0x0000000190dff96c -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 28 AppKit 0x0000000190dff678 -[NSApplication(NSEventRouting) nextEventMatchingMask:untilDate:inMode:dequeue:] + 72 29 AppKit 0x000000019025d13c -[NSApplication run] + 368 30 AppKit 0x00000001902357b0 NSApplicationMain + 880 31 AppKit 0x000000019047c958 +[NSWindow _savedFrameFromString:] + 0 32 UIKitMacHelper 0x00000001aa2651bc UINSApplicationMain + 972 33 UIKitCore 0x00000001c4e1aed4 UIApplicationMain + 144 34 UIKitCore 0x00000001c548bda0 block_destroy_helper.31 + 8880 35 DigitalConcertHall.debug.dylib 0x0000000106e41bd8 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 128 36 DigitalConcertHall.debug.dylib 0x0000000106e41b4c $s18DigitalConcertHall11AppDelegateC5$mainyyFZ + 32 37 DigitalConcertHall.debug.dylib 0x0000000106e4afc0 __debug_main_executable_dylib_entry_point + 28 38 dyld 0x000000018b9ac4e4 start + 6992 ) I could not test with the iOS 27 beta 4 SDK due to this blocking issue: https://developer.apple.com/forums/thread/839012 However, when I tried to set up a simple sample project, I could not reproduce the issue. Does anybody know what might be causing this? I filed feedback FB24201508
Replies
8
Boosts
2
Views
2.1k
Activity
5d
Keeping the display awake during hands-free auto-scroll in a watchOS reading app
I develop Folito, a free watchOS app for reading EPUB books on Apple Watch. We added an auto-scroll mode: the text scrolls continuously at a speed the user sets with the Digital Crown, so they can read hands-free with their wrist raised. The display dims after the wake timeout because auto-scroll isn't user interaction, so the text becomes hard to read after 15–70 seconds while the user is still reading. What we've considered Pausing on isLuminanceReduced and resuming on tap. This works, but it needs a touch every minute. Continuing in Always On (luminance reduced) with ~1 Hz line-by-line updates. This is our current plan, but the text is dimmed and SE models have no Always On. WKExtendedRuntimeSession. None of the session types (self care, mindfulness, physical therapy, smart alarm, workout) describes reading, and we don't want to misuse one. HKWorkoutSession. Not appropriate, because it would record fake workouts. Questions Is there a supported way for a frontmost app to keep the display at normal brightness while showing continuously changing content the user is reading, without touch input? Would a WKExtendedRuntimeSession started only while auto-scroll runs (and ended as soon as it pauses or stops) be acceptable for this, and if so, which type? In Always On, what's the recommended way to keep text content advancing (for example, updating a ScrollView position via ScrollViewReader about once per second)? I found thread 720495 (iOS, isIdleTimerDisabled) and thread 122753 (Always On, 2019), but neither covers a watchOS app that needs the display awake while content advances on its own. Deployment target: watchOS 10, SwiftUI. Thanks!
Replies
1
Boosts
0
Views
271
Activity
5d
UIWindowScene sizeRestrictions minimumSize not working on iPadOS
Hello, following Apple docs and guidance from WWDC I'm trying to set a minimum size for my scene, for example I want it to minimally be 3/4 the width and height of the device. I've removed the UIRequiresFullScreen Info.plist property. The app does run in windowed mode and does have a resizing handle. I've implemented this UISceneDelegate: var window: UIWindow? var cameraWindow: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window = UIWindow(windowScene: scene as! UIWindowScene) // setup root view controller let rootViewController: MainViewController = MainViewController(nibName: "Main", bundle: nil) let navController: NavigationController = NavigationController(rootViewController: rootViewController) navController.modalPresentationStyle = .fullScreen // set reasonable minimum sizes for WindowScene if let windowScene: UIWindowScene = scene as? UIWindowScene { if #available(iOS 16.0, *) { let windowSize: CGSize = windowScene.coordinateSpace.bounds.size windowScene.sizeRestrictions?.minimumSize.width = windowSize.width * 0.75 windowScene.sizeRestrictions?.minimumSize.height = windowSize.height * 0.75 } } window?.rootViewController = navController window?.makeKeyAndVisible() } } And proven via debugger that this code is being executed. I have the following observations: After setting these minimumSize properties I see the width and height both contain 0 afterwards, as if the property settings are discarding the value. I've even used hard-coded values instead of reading the coordinateSpace.bounds, to no avail. The scene is allowing resizing well below these minimums, about 1/3 the width and 1/2 the height. Anyone else observed this and have suggestions?
Topic: UI Frameworks SubTopic: UIKit
Replies
1
Boosts
1
Views
372
Activity
5d
Using SF Symbols with a changed global locale
When changing the global locale by std::locale::global(std::locale(NAME)) where NAME is a valid and supported name of a locale all access using [UIImage systemImageNamed:@"..."] fails. Is there a way to modify the global locale and still have access to the SF Symbols?
Replies
2
Boosts
0
Views
279
Activity
5d
Can I use a template image for quick actions?
Hey Team, System-provided quick actions in Finder sport a template image that adapts correctly to light and dark modes. However when I add a quick action extension in my app, the icon I refer to in the Info.plist renders in full color, even if it is defined in the asset catalog as a template image. This forces me to either use my app icon or a gray icon that will work in either appearance. How can I get the system-provided quick actions treatment? Thanks, Ari
Topic: UI Frameworks SubTopic: AppKit
Replies
2
Boosts
1
Views
320
Activity
6d
NavigationSplitView sidebar expansion temporarily oversizes split view and collapses toolbar search
[Submitted as FB25597038] Showing the sidebar in a two-column NavigationSplitView briefly collapses the toolbar search field, even though the window doesn't resize. Search is right-aligned on the detail container using .searchable, ToolbarSpacer(.flexible), and DefaultToolbarItem(kind: .search). The sample below uses static content and the native sidebar toggle and animation. Setting only the sidebar item's collapseBehavior to .useConstraints avoids the issue. It occurred in both recorded baseline expansions and neither expansion with the workaround. Environment macOS 27.2.1 (26B131) Xcode 27.2 (27B52) macOS SDK 27.2 (26B118) Native macOS app, arm64, deployment target macOS 27.0 Initial window: 906 × 600 points Sidebar minimum/ideal/maximum widths: 180/240/360 points Repro Create a new macOS App project named SidebarAnimationRepro, using SwiftUI and Swift. Set the deployment target to macOS 27.0. Replace SidebarAnimationReproApp.swift and ContentView.swift with the code below. Leave usesWorkaround set to false. Build and run. Keep the initial 906-point window width. Click Hide Sidebar and let the transition settle. Click Show Sidebar and watch the search field during expansion. Stop the app, change usesWorkaround to true, and run again. Repeat steps 4–5 to compare the behavior. Expected The split view should stay within the window during sidebar expansion. The search field should stay visible at its normal width without briefly collapsing or disappearing. Actual The split view temporarily grows to 1,146 points while the window stays 906 points wide. Search shrinks from 325 to 36 points and disappears, then returns to its normal size and visibility. The toolbar, search item, and search field remain the same instances, and toolbar item order doesn't change. In one capture, search collapsed about 123 ms after expansion started, returned at 274 ms, and the split view settled at 283 ms. With .useConstraints, the split view stayed at 906 points and search stayed visible at 325 points throughout both hide/show cycles. Screenshots Three frames before, during, and after the sidebar expansion: Sample Code SidebarAnimationReproApp.swift import SwiftUI @main struct SidebarAnimationReproApp: App { var body: some Scene { WindowGroup("Sidebar Animation Repro") { ContentView() } .defaultSize(width: 906, height: 600) } }ContentView.swift import AppKit import SwiftUI struct ContentView: View { @State private var searchText = "" var body: some View { NavigationSplitView { List { Label("Example", systemImage: "folder") } .navigationSplitViewColumnWidth(min: 180, ideal: 240, max: 360) } detail: { Text("Synthetic detail content") .frame(minWidth: 0, maxWidth: .infinity, maxHeight: .infinity) .background { SplitViewAttachment() } .searchable(text: $searchText, placement: .toolbar) .toolbar { ToolbarSpacer(.flexible) DefaultToolbarItem(kind: .search) } } .toolbar(removing: .title) .frame(minWidth: 720, minHeight: 420) } } struct SplitViewAttachment: NSViewRepresentable { func makeNSView(context: Context) -> Attachment { Attachment() } func updateNSView(_ view: Attachment, context: Context) { view.applyWorkaround() } final class Attachment: NSView { private let usesWorkaround = false override func hitTest(_ point: NSPoint) -> NSView? { nil } override func viewDidMoveToWindow() { super.viewDidMoveToWindow() applyWorkaround() } /// The split controller can enter the responder chain after the view enters its window. override func layout() { super.layout() applyWorkaround() } fileprivate func applyWorkaround() { guard usesWorkaround, window != nil else { return } let responders = sequence(first: self as NSResponder, next: \.nextResponder) guard let controller = responders.first(where: { $0 is NSSplitViewController }) as? NSSplitViewController, let sidebar = controller.splitViewItems.first(where: { $0.behavior == .sidebar }), sidebar.collapseBehavior != .useConstraints else { return } sidebar.collapseBehavior = .useConstraints } } }
Replies
0
Boosts
0
Views
50
Activity
6d
@FocusedValue from .focusedSceneValue from the Scene Commands
Hi, In iPadOS can we use a .focusedSceneValue, defined from a command/Button inside a Scene, from inside the .command modifier attached to the scene? Like this: @main struct test_focusedSceneValueApp: App {     var body: some Scene {         WindowGroup {             ContentView()         }         .commands {             NavigationCommands()         }     } } struct NavigationCommands: Commands {     @FocusedValue(\.filterAction) var filterAction     var body: some Commands {         CommandMenu("Navigate") {             Button("Test focusedSceneValue") {                 filterAction?()             }             .keyboardShortcut("5")         }     } } struct ContentView: View {     @FocusState var isFiltering: Bool     @State private var focusField: String = "teste field teste"     var body: some View {         TextField("teste focus", text: $focusField)             .focused($isFiltering)             .focusedSceneValue(\.filterAction) {                 print("test successful")                 isFiltering = true             }     } This code is almost the same from the sample code from the documentation, however I can only retrieved nil values from the @FocusedValue and not the defined value. Thanks.
Replies
5
Boosts
0
Views
2.2k
Activity
1w
Article Accelerator tutorial: “Dissecting an app’s architecture” doesn’t explain data flow, and ArticleStore isn’t a realistic network simulation
Here's a sharper version. It's blunt about how badly the app is built, but it avoids swearing and insults, because forum moderators remove posts like that. Title: Article Accelerator: an architecture tutorial built on patterns we shouldn't copy Text: The tutorial "Dissecting an app's architecture" promises to show how data flows in and through Article Accelerator: https://developer.apple.com/tutorials/app-dev-training/dissecting-an-apps-architecture For a tutorial whose whole subject is architecture, the sample app is a poor example of it. The article never actually traces the data flow, and the code it describes uses patterns that most SwiftUI guidance tells you to avoid. The "simulated network service" isn't one. The tutorial says ArticleStore simulates a network service. In reality it's a singleton that synchronously loads JSON files from the bundle. It can't be slow, can't fail and can't return partial data, so it simulates none of what makes networking hard. It cannot be turned into an async URLSession call without throwing it away and redesigning the data layer. Views fetch data directly from a singleton. DetailView does private let articles = ArticleStore.shared.articles() as a stored property. There's no @Observable model, no loading state, no error state, and no dependency injection. This makes the views impossible to test with fake data and hides the data flow the tutorial claims to explain. Error handling is print and fatalError. A broken article file is silently skipped with print. An unreadable folder crashes the app. Failing to delete user data also crashes the app. SwiftData setup is inconsistent. The app creates one ModelContainer, then ArticleStateManager creates a separate ModelContext instead of using the container's mainContext. So writes through the manager and @Query reads go through different contexts. On top of that, the environment default for articleStateManager quietly creates a second ModelContainer with try!, so any window that forgets to inject it gets a different container. The structure isn't structured. The tutorial's challenge asks you to sort the Models folder into three categories, but the project puts everything in one flat folder, including ArticleStateManager, which isn't a model at all. Article, the main model, isn't even in it. The key design decision is never explained. Articles live only in memory while user data lives in SwiftData, and views join them by ID. That's a reasonable split, but the tutorial never says so, never explains why, and never addresses what it means for offline support, caching or paging. A learner who expects "fetch, store in SwiftData, show with @Query" is left confused. Official Apple tutorials are where many developers learn what good practice looks like. An article called "Dissecting an app's architecture" should either show a sound architecture, or clearly label the shortcuts as shortcuts. Right now it does neither. My questions: Is ArticleStore intended as a pattern to follow, or only a placeholder? What would Apple recommend for this app's data layer with a real async network service, including caching and paging?
Replies
0
Boosts
0
Views
163
Activity
1w
.bottomBar toolbar item missing after rotation in NavigationSplitView on iOS 26 (Regular width / compact height)
A ToolbarItem(placement: .bottomBar) inside a NavigationSplitView detail/destination view is missing after a device rotation on iOS 26. The bottom toolbar is missing until the view has been presented in both orientations, after which it renders correctly from then on. The issue does not reproduce on iOS 18. Environment iOS 26 only — does not reproduce on iOS 18 iPhone 17 Pro Max and iPhone 17 Air (i.e. devices that expose the landscape size class Regular width / compact height) SwiftUI NavigationSplitView with .balanced style Steps to reproduce Run the sample below on an iPhone 17 Pro Max or Air (or a simulator of either). Open the detail view (which contains a .bottomBar toolbar item) while the device is in either orientation. Rotate the device. Observe that the bottom toolbar is now missing. Expected behavior The .bottomBar button remains visible across rotation, regardless of which orientation the view was first presented in. Actual behavior On first presentation, rotating the device causes the bottom toolbar to disappear. Once the view has been presented in both landscape and portrait (roughly the third presentation), the bottom bar renders correctly and continues to behave correctly afterward. The behavior is inconsistent import SwiftUI @main struct MinimumReproducibleEventApp: App { var body: some Scene { WindowGroup { NavigationSplitView(columnVisibility: .constant(.all)) { NavigationLink("Primary") { ContentView() } } detail: { Text("Hello") } .navigationSplitViewStyle(.balanced) } } } ContentView import SwiftUI struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .toolbar { ToolbarItem(placement: .bottomBar) { Button("Hello") { print("hello") } } } } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
7
Boosts
2
Views
595
Activity
1w
PhotosPicker selection badges initially appear blue, then change to the correct tint after backgrounding
Hello Apple Developer Team, I’m developing an iOS camera app called 1/250 using SwiftUI and the system photo picker (PhotosPicker). I’ve encountered an issue where the photo picker’s selection badge colors are inconsistent between the initial presentation and returning from the background. Steps to Reproduce 1. Open the app and present PhotosPicker. 2. Select multiple photos. 3. The numbered selection badges (1, 2, 3, etc.) appear in the default system blue, despite the app using yellow as its accent color. 4. Send the app to the background without dismissing PhotosPicker. 5. Return to the app. 6. The same selection badges now appear in the correct yellow color. Expected Behavior The numbered selection badges should use the app’s yellow tint color consistently, including when PhotosPicker is first presented. Actual Behavior * Initial presentation: Blue selection badges. * After backgrounding and returning: Yellow selection badges. * No changes to the selected photos or app settings are required. Questions 1. Is this a known issue with SwiftUI PhotosPicker or its underlying UIKit implementation? 2. Why would the tint color be applied correctly only after the app returns from the background? 3. Is there a recommended way to ensure the correct tint is applied before the picker is first displayed? 4. Is there an Apple-supported workaround that avoids recreating or replacing the system photo picker? I would prefer to continue using Apple’s native PhotosPicker rather than implementing a custom photo selection interface. Any guidance from Apple engineers would be greatly appreciated. Thank you!
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
140
Activity
1w
macOS 27 has a bit laggier menus than recent macOS versions. Can that be improved?
While not always too obvious there is sometimes delay or ”hiccup” when moving the arrow pointer horizontally among the menus for an app in top left of the menu bar. This feels like a regression from previous macOS versions. I hope this will improve in fuiture macOS 27 updates as it adds a bit of friction in the user interface experience. Wanted to add a video, but since only images seem supported to upload I might link to it later.
Topic: UI Frameworks SubTopic: General
Replies
1
Boosts
0
Views
105
Activity
1w
How to disable a custom detent in a UISheetPresentationController
If you are creating a UISheetPresentationController with custom detents and you have a need to disable one of the detents, then you can do so by returning a special value from the detent's resolver. This is addressed in the Objective-C documentation for customDetentWithIdentifier:resolver:. You return the special value UISheetPresentationControllerDetentInactive. For example: UISheetPresentationControllerDetent *customDetent = [UISheetPresentationControllerDetent customDetentWithIdentifier:@"customId" resolver:^CGFloat(id<UISheetPresentationControllerDetentResolutionContext> _Nonnull context) { if (some condition) { return UISheetPresentationControllerDetentInactive; } else { return context.maximumDetentValue / 3.0; } }];However, if you wish to do this in Swift, there is no corresponding API for UISheetPresentationControllerDetentInactive. It turns out that you can just use .greatestFiniteMagnitude instead. For example: let customDetent = UISheetPresentationController.Detent.custom(identifier: .init("customId")) { context in if some condition { return .greatestFiniteMagnitude //UISheetPresentationControllerDetentInactive } else { return context.maximumDetentValue / 3.0 } }It might be tempting to add the following: extension UISheetPresentationController.Detent { static let Inactive = CGFloat.greatestFiniteMagnitude }but this could cause a conflict if Apple adds a similar API in the future. This oversight in the Swift API has been reported as FB25567661.
Replies
1
Boosts
0
Views
126
Activity
1w