Provide views, controls, and layout structures for declaring your app's user interface using SwiftUI.

SwiftUI Documentation

Posts under SwiftUI subtopic

Post

Replies

Boosts

Views

Activity

Using .glassEffect in Charts
Hi, I was wondering if it's possible (and advisable) to use the new glass effects available in iOS 26 in Swift Charts? For example, in a chart like the one in the image I've attached to this post, I was looking to try adding a .glassEffect modifier to the BarMarks to see how that would look and feel. However, it seems it's not available directly on the BarMark (ChartContent) type, and I'm having trouble adding it in other ways too, such as using in on the types I supply to modifiers like foregroundStyle or clipShape. Am I missing anything? Maybe it's just not advisable or necessary to use glass effects within Charts?
6
1
558
12h
Is it possible to focus a non-textField on iPadOS in SwiftUI?
I would like to implement a focus-based Menu-Bar command in my SwiftUI iPadOS app, or react to key command while certain elements are focused. Traditionally, this requires using @FocusedValue and focusable() and focused, however, it appears that setting a @FocusState on macOS will work, but setting a @FocusState on iPadOS will never work. How can this API work and support MenuBar commands and keyboard inputs? It kind of has an accessibility impact as well. Not all users are going to know, or want to turn on "full keyboard control" for basic interactions. Here's a small sample that doesn't appear to focus on iPadOS: struct FocusableTestView: View { @FocusState private var isRectFocused: Bool var body: some View { VStack { // This text field should focus the custom input when pressing return: TextField("Enter text", text: .constant("")) .textFieldStyle(.roundedBorder) .onSubmit { isRectFocused = true } .onKeyPress(.return) { isRectFocused = true return .handled } // This custom "input" should focus itself when tapped: Rectangle() .fill(isRectFocused ? Color.accentColor : Color.gray.opacity(0.3)) .frame(width: 100, height: 100) .overlay( Text(isRectFocused ? "Focused" : "Tap me") ) .focusable(true) .focused($isRectFocused) .onTapGesture { isRectFocused = true print("Focused rectangle") } // The focus should be able to be controlled externally: Button("Toggle Focus") { isRectFocused.toggle() } .buttonStyle(.bordered) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) } }
0
0
122
1d
Focusable doesn't work on iPad with external keyboard
I have a custom input view in my app which is .focusable(). It behaves similar to a TextField, where it must be focused in order to be used. This works fine on all platforms including iPad, except when when an external keyboard is connected (magic keyboard), in which case it can't be focused anymore and becomes unusable. Is there a solution to this, or a workaround? My view is very complex, so simple solutions like replacing it with a native view isn't possible, and I must be able to pragmatically force it to focus. Here's a very basic example replicating my issue. Non of the functionality works when a keyboard is connected: struct FocusableTestView: View { @FocusState private var isRectFocused: Bool var body: some View { VStack { // This text field should focus the custom input when pressing return: TextField("Enter text", text: .constant("")) .textFieldStyle(.roundedBorder) .onSubmit { isRectFocused = true } .onKeyPress(.return) { isRectFocused = true return .handled } // This custom "input" should focus itself when tapped: Rectangle() .fill(isRectFocused ? Color.accentColor : Color.gray.opacity(0.3)) .frame(width: 100, height: 100) .overlay( Text(isRectFocused ? "Focused" : "Tap me") ) .focusable(true, interactions: .edit) .focused($isRectFocused) .onTapGesture { isRectFocused = true print("Focused rectangle") } // The focus should be able to be controlled externally: Button("Toggle Focus") { isRectFocused.toggle() } .buttonStyle(.bordered) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) } }
2
0
262
1d
error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination
please help, i am new to SWIFTUI getting an error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. struct debug_navigation_3: View { @State private var path = NavigationPath() @StateObject private var debug_Client_Lead_Data_ListVM = Debug_Client_Lead_Data_List_Model() var body: some View { NavigationStack(path:$path) { VStack { List(debug_Client_Lead_Data_ListVM.Debug_Client_Lead_Data_Rows, id: \.self) { curr_clientLeadRequest in NavigationLink(curr_clientLeadRequest.Client_Message, value: curr_clientLeadRequest.Client_Message) } } .navigationDestination(for:Debug_Client_Lead_Data.self) { curr_clientLeadRequest in debug_navigation_3_DetailView(rec_id: Int64(curr_clientLeadRequest.id)) } } .onAppear() { Task { await debug_Client_Lead_Data_ListVM.search(rec_id:Int64(0)) //bring all REST API } } } } // data model import Foundation struct Debug_Client_Lead_Data_Response: Decodable { let Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data] private enum CodingKeys: String, CodingKey { case Debug_Client_Lead_Data_Rows = "rows" // root tag: REST API } } struct Debug_Client_Lead_Data: Decodable, Hashable, Identifiable { let id:Int32 let Client_Message: String private enum CodingKeys: String, CodingKey { case id = "id" case Client_Message = "Client_Message" } } //list view model import Foundation @MainActor class Debug_Client_Lead_Data_List_Model: ObservableObject { @Published var Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data_ListViewModel] = [] func search(rec_id:Int64) async { do { let Debug_Client_Lead_Data_Rows = try await Webservice_debug_client_lead_data().getClientLeadRequestSummary(rec_id:rec_id) // '0' optional self.Debug_Client_Lead_Data_Rows = Debug_Client_Lead_Data_Rows.map(Debug_Client_Lead_Data_ListViewModel.init) } catch { print(error) } } } struct Debug_Client_Lead_Data_ListViewModel: Identifiable, Hashable { let debug_Client_Lead_Data: Debug_Client_Lead_Data var id:Int32 { debug_Client_Lead_Data.id } var Client_Message: String { debug_Client_Lead_Data.Client_Message } } //REST API import Foundation class Webservice_debug_client_lead_data { func getClientLeadRequestSummary(rec_id:Int64) async throws -> [Debug_Client_Lead_Data] { var components = URLComponents() components.scheme = Global_REST_API_URL_HTTP components.host = Global_REST_API_URL components.port = Global_REST_API_URL_port components.path = "/GetClientLeadRequest" components.queryItems = [ URLQueryItem(name: "rec_id", value: String(rec_id)) // Optional, pass '0' for all rows ] guard let url = components.url else { throw NetworkError.badURL } let (data, response) = try await URLSession.shared.data(from: url) guard (response as? HTTPURLResponse)?.statusCode == 200 else {throw NetworkError.badID } let Debug_Client_Lead_Data_Response = try? JSONDecoder().decode(Debug_Client_Lead_Data_Response.self, from: data) return Debug_Client_Lead_Data_Response?.Debug_Client_Lead_Data_Rows ?? [] } }
Topic: UI Frameworks SubTopic: SwiftUI
2
0
394
1d
Gesture causing AGGraphGetValue
I have a custom UIGestureRecognizerRepresentable that causes a crash. Only happens about once a week, and that’s with about a thousand times it gets invoked. But it’s persistent and annoying when it happens. The code looks like func handleUIGestureRecognizerAction(_ recognizer: Recognizer, context: Context) { let startLocation = context.converter.convert(globalPoint: recognizer.startLocation, to: coorinateSpace) coorinateSpace is set in init and has crashed on .global, .local, and .named("foo") The convert function gets caught in a AGGraphGetValue loop before finally failing. It has happened while attached to the debugger, but there is not any more information than is in the logs. I don’t even know why it would invoke AttributeGraph in the first place. Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x23aedd1d0 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1eb0cf7dc pthread_kill + 268 2 libsystem_c.dylib 0x197a89c98 abort + 148 3 AttributeGraph 0x1befffef0 AG::precondition_failure(char const*, ...) + 216 4 AttributeGraph 0x1bf000f68 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 936 5 AttributeGraph 0x1beffb2a8 AGGraphGetValue + 232 6 SwiftUICore 0x19626eee8 specialized UnaryLayoutComputer.updateValue() + 92 7 SwiftUICore 0x196bdc9cc specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 24 8 AttributeGraph 0x1bf001914 AG::Graph::UpdateStack::update() + 496 9 AttributeGraph 0x1bf00152c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 352 10 AttributeGraph 0x1bf000e68 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 680 11 AttributeGraph 0x1beffb2a8 AGGraphGetValue + 232 12 SwiftUICore 0x196287604 specialized UnaryChildGeometry.value.getter + 92 13 SwiftUICore 0x196a21bc0 specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 52 14 AttributeGraph 0x1bf001914 AG::Graph::UpdateStack::update() + 496 15 AttributeGraph 0x1bf00152c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 352 16 AttributeGraph 0x1bf000e68 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 680 17 AttributeGraph 0x1beffb2a8 AGGraphGetValue + 232 18 SwiftUICore 0x196a21b28 specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 72 19 AttributeGraph 0x1bf001914 AG::Graph::UpdateStack::update() + 496 20 AttributeGraph 0x1bf00152c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 352 21 AttributeGraph 0x1beffb560 AG::Graph::value_ref(AG::AttributeID, unsigned int, AGSwiftMetadata const*, unsigned char&) + 296 22 AttributeGraph 0x1beffb2f8 AGGraphGetValue + 312 23 AttributeGraph 0x1bf00206c AGGraphGetInputValue + 60 24 SwiftUICore 0x19626d0a8 GeometryProxy.transform.getter + 220 25 SwiftUICore 0x19699ce80 GeometryProxy.convert<A>(globalPoint:to:) + 76 26 SwiftUI 0x195ddf71c UIGestureRecognizerRepresentableCoordinateSpaceConverter.convert<A>(globalPoint:to:) + 76 27 myapp.debug.dylib 0x1033b3a30 MyAppDragGesture.handleUIGestureRecognizerAction(_:context:) + 1560
Topic: UI Frameworks SubTopic: SwiftUI
1
0
282
1d
`FigAudioSession(AV) err=-19224` triggered by empty Button tap on visionOS 26.5, breaking subsequent AVAudioSession configuration
Environment Device: Apple Vision Pro (real device) OS: visionOS 26.5 Xcode: 26.5 Framework: AVFAudio / AVFoundation Summary On visionOS 26.5, tapping an empty Button consistently emits the following internal warning before the action closure executes: <<<< FigAudioSession(AV) >>>> signalled err=-19224 (<>:612) After this warning is emitted, any subsequent call to configure AVAudioSession silently stops working — audio input and output become non-functional for the lifetime of the session. If the same configuration is performed without a preceding button tap (e.g., inside View.task {}), it succeeds and audio works correctly. Reproduction Due to a dependency on LiveKitWebRTC (livekit/webrtc-xcframework) for WebRTC-based Realtime API audio, we are unable to provide a full self-contained sample project. However, the AVAudioSession configuration code involved is as follows: static func configureAudioSession() { #if !os(macOS) do { let audioSession = AVAudioSession.sharedInstance() #if os(tvOS) try audioSession.setCategory(.playAndRecord, options: []) #else try audioSession.setCategory(.playAndRecord, options: [.defaultToSpeaker]) #endif try audioSession.setMode(.videoChat) try audioSession.setActive(true, options: .notifyOthersOnDeactivation) } catch { print("Failed to configure AVAudioSession: \(error)") } #endif } Scenario A — Button tap (fails): Button("Start") { configureAudioSession() // FigAudioSession err=-19224 appears; audio stops working } Scenario B — View.task (succeeds): .task { configureAudioSession() // No warning; audio works correctly } The only difference is whether a user gesture (Button tap) precedes the call. Observed Behavior Tapping any Button on visionOS 26.5 causes FigAudioSession(AV) err=-19224 to be signalled at <>:612, even before the action closure runs. After this warning, AVAudioSession configuration appears to have no effect — setActive(true) does not throw, but audio appears to stop functioning. Configuring the session prior to any button interaction (e.g., in View.task {}) works correctly. Expected Behavior A Button tap should not implicitly interfere with the audio session state. AVAudioSession configuration should succeed regardless of the UI event context that triggers it. Questions What does FigAudioSession(AV) err=-19224 mean? Does it correspond to a documented AVAudioSession.ErrorCode? Why does a Button tap trigger a FigAudioSession signal on visionOS? Is the system performing implicit audio session management when detecting user interaction? Is there a recommended pattern for configuring AVAudioSession in response to a user gesture on visionOS? Our current workaround (View.task {}) is not suitable for on-demand audio start triggered by the user. Is err=-19224 causally responsible for the subsequent audio issue? Since setActive(true) does not throw after the warning, it is unclear whether this signal is the direct cause of the apparent audio failure or a symptom of a deeper conflict. Are there UI components or APIs on visionOS that do not trigger this signal, while still being user-interaction driven? Additional Notes Reproducible only on physical Apple Vision Pro hardware; not observed in Simulator. AirPlay mirroring is not in use during testing. No other apps are playing audio in the background at the time of reproduction. We use LiveKitWebRTC (livekit/webrtc-xcframework, revision 94ce1c9) for WebRTC audio. However, the FigAudioSession warning appears independently of the WebRTC layer — it is emitted on Button tap even before configureAudioSession() is called. We have verified that calling configureAudioSession() before performHandshake() (i.e., before WebRTC initializes its audio pipeline) does not resolve the issue when a Button tap precedes the call.
0
0
66
2d
Is updateUIViewController always called immediately after makeUIViewController?
I'm in the unenviable position of needing the current UIViewController to keep an external library happy. Essentially, I need to do this in SwiftUI: import LibraryOutOfMyControl ViewControllerReader { viewController in Button("Action") { LibraryOutOfMyControl.action(with: viewController) } } My simple attempt below functions correctly but I'm relying on makeUIViewController always being immediately followed by updateUIViewController. Is the a reasonable assumption or should I set everything up assuming updateUIViewController might never be called? struct ViewControllerReader<Content>: UIViewControllerRepresentable where Content: View { @ViewBuilder var content: (UIViewController) -> Content func makeUIViewController(context: Context) -> UIHostingController<Content> { UIHostingController(rootView: content(UIViewController())) } func updateUIViewController(_ uiViewController: UIHostingController<Content>, context: Context) { uiViewController.rootView = content(uiViewController) uiViewController.view.isUserInteractionEnabled = context.environment.isEnabled } func sizeThatFits(_ proposal: ProposedViewSize, uiViewController: UIHostingController<Content>, context: Context) -> CGSize? { uiViewController.sizeThatFits(in: proposal.replacingUnspecifiedDimensions()) } }
0
0
89
2d
SwiftUI navigation bar button color changes depending on whether the root view is a ScrollView or VStack
I have a SwiftUI view inside a NavigationStack with a custom navigation bar background color. I want the navigation bar buttons to have a consistent color throughout the app. The issue is that the navigation bar button color changes depending on the first/root view in the body. When the root view is a ScrollView var body: some View { ScrollView { // content } .toolbarBackground(Color(red: 0.02, green: 0.27, blue: 0.13), for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) .toolbarColorScheme(.dark, for: .navigationBar) } The navigation bar buttons appear white. However, if I replace the ScrollView with a VStack, while keeping the same modifiers, the navigation bar buttons appear black: var body: some View { VStack { // content } .toolbarBackground(Color(red: 0.02, green: 0.27, blue: 0.13), for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) .toolbarColorScheme(.dark, for: .navigationBar) } The navigation bar buttons appear black. How can I make the navigation bar buttons stay the same colour in both cases?
1
0
168
2d
Challenges using SwiftUI views inside an NSToolbarItem
I'm trying to use SwiftUI views inside an NSToolbarItem, and I feel like I'm fighting the system. The goal is to create custom toolbar controls. I don't want AppKit or SwiftUI to recognize that there's a SwiftUI view in the toolbar and then try to style it automatically, which is what I think is happening. Consider this hierarchy: - NSToolbar - NSToolbarItem - view -> MyCustomNSView - addSubview(NSHostingView<CustomView>) So CustomView is inside an NSHostingView, which is inside an NSView, which is assigned to the .view property of an NSToolbarItem. For a while, I struggled to get this working at all because SwiftUI's layout metrics appeared to be affected by safe area insets. SwiftUI's ignoresSafeArea() only seemed to move the problem around. For now, I've disabled full-size content view, which I don't really need anyway. However, a SwiftUI Button or Menu still doesn't behave or style the way I would expect when placed inside an NSToolbarItem. They don't seem to honor many of the styling attributes or view modifiers that work elsewhere. Is there a way to tell AppKit to "ignore" the children of my NSToolbarItem and not apply toolbar-specific styling to them? Am I even correct in thinking that AppKit is recognizing a Button or Menu in the toolbar and forcibly applying styling to it? Previously, I tried implementing my "custom toolbar" entirely outside of NSToolbar, but then SwiftUI struggled with placing views under the transparent, non-existent toolbar. I'd appreciate any direction or hints here. It would be really nice to use SwiftUI for the controls I have in mind, but at the moment I can't get close to the result I'm aiming for.
0
0
92
2d
.disabled() doesn't VISUALLY disable buttons inside ToolbarItem on iOS 26 devices
[Also submitted as FB19313064] The .disabled() modifier doesn't visually disable buttons inside a ToolbarItem container on iOS 26.0 (23A5297i) devices. The button looks enabled, but tapping it doesn't trigger the action. When deployment target is lowered to iOS 18 and deployed to an iOS 18 device, it works correctly. It still fails on an iOS 26 device, even with an iOS 18-targeted build. This occurs in both the Simulator and on a physical device. Screen Recording Code struct ContentView: View { @State private var isButtonDisabled = false private var osTitle: String { let version = ProcessInfo.processInfo.operatingSystemVersion return "iOS \(version.majorVersion)" } var body: some View { NavigationStack { VStack { Button("Body Button") { print("Body button tapped") } .buttonStyle(.borderedProminent) .disabled(isButtonDisabled) Toggle("Disable buttons", isOn: $isButtonDisabled) Spacer() } .padding() .navigationTitle("Device: \(osTitle)") .navigationBarTitleDisplayMode(.large) .toolbar { ToolbarItem { Button("Toolbar") { print("Toolbar button tapped") } .buttonStyle(.borderedProminent) .disabled(isButtonDisabled) } } } } }
8
3
709
3d
SwiftUI Button with Image view label has smaller hit target
[Also submitted as FB20213961] SwiftUI Button with a label: closure containing only an Image view has a smaller tap target than buttons created with a Label or the convenience initializer. The hit area shrinks to the image bounds instead of preserving the standard minimum tappable size. SCREEN RECORDING On a physical device, the difference is obvious—it’s easy to miss the button. Sometimes it even shows the button-tapped bounce animation but doesn’t trigger the action. SYSTEM INFO Xcode Version 26.0 (17A321) macOS 15.6.1 (24G90) iOS 26.0 (23A340) SAMPLE CODE The following snippet shows the difference in hit targets between the convenience initializer, a Label, and an Image (the latter two in a label: closure). // ✅ Hit target is entire button Button("Button 1", systemImage: "1.square.fill") { print("Button 1 tapped") } // ✅ Hit target is entire button Button { print("Button 2 tapped") } label: { Label("Button 2", systemImage: "2.square.fill") } // ❌ Hit target is smaller than button Button { print("Button 3 tapped") } label: { Image(systemName: "3.square.fill") }
6
4
456
3d
Changing systemImage value for Image, logs "fopen failed for data file".
I'm getting a log error and a slight delay in the UI when displaying a system image that changes at the end of a sequence. I'm using a ternary operator to determine the image; the fact that the image changes seem to be the issue, rather than the value itself. The issue only occurs for a newly installed app, and not when the app is rerun. (I'm using similar code to display an onboarding sequence after installation.) This happens on device (iphone 15 pro v25.6) and simulator (iphone 17 pro v25.6 and iphone 16 pro v18.5); xcode 26.5 (17F42). Console errors (device and iphone 17 simulator): fopen failed for data file: errno = 2 (No such file or directory) fopen failed for data file: errno = 2 (No such file or directory) Repro Code: import SwiftUI struct ContentView: View { // NOTE: error only occurs with new install. @State private var currentItem = 0 @State private var totalItems: Int = 4 var body: some View { VStack(spacing: 0) { Spacer() Text("totalItems: \(totalItems)") TabView(selection: $currentItem) { ForEach(0...totalItems, id: \.self) { item in Text("\(item) ~ \(currentItem)") .tag(item) } } //TV .tabViewStyle(.page(indexDisplayMode: .never)) .frame(height: 200) Button { if currentItem < totalItems { currentItem += 1 currentItem = min(totalItems, currentItem) } } label: { let imgString: String = (currentItem == totalItems ? "arrowshape.turn.up.right" : "arrowshape.right") // error // let imgString: String = ((currentItem == totalItems) ? "x.circle" : "smallcircle.filled.circle") // error // let imgString: String = "smallcircle.filled.circle" // no error // let imgString: String = "x.circle" // no error Text("\(imgString)") // if only print text, no error, so issue seems to be with Image. Image(systemName: imgString) } Spacer() } } } Click through the button sequence to see issue at end of sequence. Uncomment the various imgString lines to see indicated differences in behavior. Need to delete app each time to repro issue. Running in simulator on iphone 16 Pro iOS 18.5 has slightly different error messages: fopen failed for data file: errno = 2 (No such file or directory) Errors found! Invalidating cache... fopen failed for data file: errno = 2 (No such file or directory) Errors found! Invalidating cache...
1
0
49
3d
LiveActivity via Push-To-Start and Update token questions.
We are implementing starting an activity via Push-To-Start. For the most part it works great, however we have run into a few edge cases. Currently, we send the "start activity" push notification and it creates the Activity as expected. If the app doesn't send an update token w/in a configured time, we assume the activity didn't start and try to start the activity again. Occasionally we get into a situation where there have been multiple activities started, but it should really only be one. Here is my theory: We store an auth token in the keychain for all REST endpoints if the phone has been restarted and not unlocked, the app doesn't have access to the auth token and fails to send the update token to our backend. Are there any best practices on how to manage PTS and UPDATE tokens? (updating these w/o authentication seems problematic)
1
0
281
4d
FamilyActivityPicker missing search bar when embedded inline on iPad
When FamilyActivityPicker is used as an embedded view (not via the .familyActivityPicker sheet modifier), the search bar that normally appears at the bottom is not rendered on iPad. The same code shows the search bar correctly on iPhone. Environment Frameworks: SwiftUI, FamilyControls Device: iPad (reproduces on multiple models / iPadOS versions — 26.2, 26.5) iPhone: search bar appears as expected Usage The picker is placed directly inside a SwiftUI view hierarchy: import SwiftUI import FamilyControls struct ContentView: View { @State private var selection = FamilyActivitySelection() var body: some View { FamilyActivityPicker(selection: $selection) } } Expected A search field is visible at the bottom of the sheet (same as iPhone), allowing the user to search for apps/categories/websites. Actual On iPad, no search field is rendered. The picker only shows the category/app list. There is no way to search. Notes I would like the embedded FamilyActivityPicker to show the same search affordance on iPad that it shows on iPhone, so apps that rely on custom surrounding UI don't have to give it up to gain search.
1
0
143
5d
Search Functionality Missing in FamilyActivityPicker on iPadOS 26.0+
Issue: The search functionality in FamilyActivityPicker has disappeared on iPadOS 26.0+. This feature was working in previous versions but is now missing. Framework: FamilyControls Expected: Search bar should be available in FamilyActivityPicker to help users find apps quickly. Actual: Search functionality is completely missing. Impact: Makes app selection difficult for users with many installed apps. Is this a known issue? If it's a bug, please address it in an upcoming update. If intentional, guidance on alternatives would be appreciated. Thank you.
2
1
175
5d
ControlCenter blocks a MenuBarExtra item due to foreign trackedApplications entry
I am seeing a reproducible issue with macOS ControlCenter's per-app menu bar tracking state in a SwiftUI MenuBarExtra app. On launch the app creates its menu bar status item. ControlCenter then reads group.com.apple.controlcenter / trackedApplications, moves the app's status item host to the blocked list, sends NSStatusItemChangeVisibilityAction with visibility=0, and the app terminates because its only status item is removed. Two observations: Changing only the bundle identifier makes the menu bar item appear normally. In trackedApplications, the affected app has its own entry with isAllowed: true; a separate entry for another app has isAllowed: false, and that disallowed foreign entry's menuItemLocations contained an entry referencing the affected app. Removing only the affected app's reference from the other app's disallowed entry fixed the issue: the app launched normally, and ControlCenter no longer sent visibility=0. ControlCenter appears to associate one app's menu item identity with another app's disallowed tracked record, letting the foreign blocked record override the app's own allowed record. Is this expected? And is there a supported way to reset this per-app ControlCenter menu bar state without editing the protected group.com.apple.controlcenter plist directly? Testing Environment: macOS 26.3 (25D125) Xcode 26.3 (17C529) LSUIElement: true Sandboxed app SwiftUI MenuBarExtra Relevant log pattern: Host properties initialized; (bid:[AffectedApp]-Item-0-[pid]) State(applicationItem: true, clientRequestsVisibility: true, neverClip: false) looked up value <private> for key trackedApplications (Domain: group.com.apple.controlcenter) Moving host to blocked list; (bid:[AffectedApp]-Item-0-[pid]) Requesting blocked host to not be visible; (bid:[AffectedApp]-Item-0-[pid]) Sending action(s): <NSStatusItemChangeVisibilityAction: ...> Received action(s): NSStatusItemChangeVisibilityAction 0 agent requesting visibility=0 temporary=0 0 terminating on removal
Topic: UI Frameworks SubTopic: SwiftUI Tags:
0
0
224
1w
Tab button's ax identifier is missing when using `.sidebarAdaptable` TabViewStyle
Hello, I found that if you apply the new .sidebarAdaptable tab view style, the accessibility identifiers of tab bar buttons are missing. import SwiftUI struct ContentView: View { var body: some View { TabView { Tab("Received", systemImage: "tray.and.arrow.down.fill") { Text("Received") } .accessibilityIdentifier("tab.received") // 👀 Tab("Sent", systemImage: "tray.and.arrow.up.fill") { Text("Sent") } .accessibilityIdentifier("tab.sent") // 👀 Tab("Account", systemImage: "person.crop.circle.fill") { Text("Account") } .accessibilityIdentifier("tab.account") // 👀 } .tabViewStyle(.sidebarAdaptable) // 👈 if remove this, ax identifiers are ok } } #Preview { ContentView() } The identifiers automatically appear after a few seconds. But this behaviour breaks a lot of the UI test cases.
3
0
643
1w
Popover in Toolbar Causes Crash in Catalyst App on macOS 26
Hi everyone, I’ve encountered an issue where using a popover inside the toolbar of a Catalyst app causes a crash on macOS 26 beta 5 with Xcode 26 beta 5. Here’s a simplified code snippet: import SwiftUI struct ContentView: View { @State private var isPresentingPopover = false var body: some View { NavigationStack { VStack { } .padding() .toolbar { ToolbarItem { Button(action: { isPresentingPopover.toggle() }) { Image(systemName: "bubble") } .popover(isPresented: $isPresentingPopover) { Text("Hello") .font(.largeTitle) .padding() } } } } } } Steps to reproduce: Create a new iOS app using Xcode 26 beta 5. Enable Mac Catalyst (Match iPad). Add the above code to show a Popover from a toolbar button. Run the app on macOS 26, then click the toolbar button. The app crashes immediately upon clicking the toolbar button. Has anyone else run into this? Any workarounds or suggestions would be appreciated! Thanks!
6
2
600
1w
Glass effect interactive effect issue when used with concentric shapes
Using .glassEffect(.clear.interactive(), in: shape), where shape is some concentric shape that adapts to corner radius of the device, results in appearing of highlighted capsule shape. Code to reproduce this behavior import SwiftUI struct HelloLiquidGlass: View { var body: some View { if #available(iOS 26.0, *) { Text("Hello, World!") .frame(maxWidth: .infinity, maxHeight: .infinity) // .glassEffect(.clear.interactive(), in: .rect(corners: .concentric)) // .glassEffect(.clear.interactive(), in: ConcentricRectangle(uniformTopCorners: .fixed(80))) .padding(36) .ignoresSafeArea() .preferredColorScheme(.dark) } } } #Preview { HelloLiquidGlass() } Either of both commented-out modifiers produces the same result when user interacts with Liquid Glass pane (revealing of capsule shape that is not relative to actual shape of liquid glass effect modifier) iOS 26.5 (23F73) SDK + iOS 26.5 (23F77) Simulator
3
0
293
1w
Using .glassEffect in Charts
Hi, I was wondering if it's possible (and advisable) to use the new glass effects available in iOS 26 in Swift Charts? For example, in a chart like the one in the image I've attached to this post, I was looking to try adding a .glassEffect modifier to the BarMarks to see how that would look and feel. However, it seems it's not available directly on the BarMark (ChartContent) type, and I'm having trouble adding it in other ways too, such as using in on the types I supply to modifiers like foregroundStyle or clipShape. Am I missing anything? Maybe it's just not advisable or necessary to use glass effects within Charts?
Replies
6
Boosts
1
Views
558
Activity
12h
Is it possible to focus a non-textField on iPadOS in SwiftUI?
I would like to implement a focus-based Menu-Bar command in my SwiftUI iPadOS app, or react to key command while certain elements are focused. Traditionally, this requires using @FocusedValue and focusable() and focused, however, it appears that setting a @FocusState on macOS will work, but setting a @FocusState on iPadOS will never work. How can this API work and support MenuBar commands and keyboard inputs? It kind of has an accessibility impact as well. Not all users are going to know, or want to turn on "full keyboard control" for basic interactions. Here's a small sample that doesn't appear to focus on iPadOS: struct FocusableTestView: View { @FocusState private var isRectFocused: Bool var body: some View { VStack { // This text field should focus the custom input when pressing return: TextField("Enter text", text: .constant("")) .textFieldStyle(.roundedBorder) .onSubmit { isRectFocused = true } .onKeyPress(.return) { isRectFocused = true return .handled } // This custom "input" should focus itself when tapped: Rectangle() .fill(isRectFocused ? Color.accentColor : Color.gray.opacity(0.3)) .frame(width: 100, height: 100) .overlay( Text(isRectFocused ? "Focused" : "Tap me") ) .focusable(true) .focused($isRectFocused) .onTapGesture { isRectFocused = true print("Focused rectangle") } // The focus should be able to be controlled externally: Button("Toggle Focus") { isRectFocused.toggle() } .buttonStyle(.bordered) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) } }
Replies
0
Boosts
0
Views
122
Activity
1d
Focusable doesn't work on iPad with external keyboard
I have a custom input view in my app which is .focusable(). It behaves similar to a TextField, where it must be focused in order to be used. This works fine on all platforms including iPad, except when when an external keyboard is connected (magic keyboard), in which case it can't be focused anymore and becomes unusable. Is there a solution to this, or a workaround? My view is very complex, so simple solutions like replacing it with a native view isn't possible, and I must be able to pragmatically force it to focus. Here's a very basic example replicating my issue. Non of the functionality works when a keyboard is connected: struct FocusableTestView: View { @FocusState private var isRectFocused: Bool var body: some View { VStack { // This text field should focus the custom input when pressing return: TextField("Enter text", text: .constant("")) .textFieldStyle(.roundedBorder) .onSubmit { isRectFocused = true } .onKeyPress(.return) { isRectFocused = true return .handled } // This custom "input" should focus itself when tapped: Rectangle() .fill(isRectFocused ? Color.accentColor : Color.gray.opacity(0.3)) .frame(width: 100, height: 100) .overlay( Text(isRectFocused ? "Focused" : "Tap me") ) .focusable(true, interactions: .edit) .focused($isRectFocused) .onTapGesture { isRectFocused = true print("Focused rectangle") } // The focus should be able to be controlled externally: Button("Toggle Focus") { isRectFocused.toggle() } .buttonStyle(.bordered) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) } }
Replies
2
Boosts
0
Views
262
Activity
1d
error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination
please help, i am new to SWIFTUI getting an error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. struct debug_navigation_3: View { @State private var path = NavigationPath() @StateObject private var debug_Client_Lead_Data_ListVM = Debug_Client_Lead_Data_List_Model() var body: some View { NavigationStack(path:$path) { VStack { List(debug_Client_Lead_Data_ListVM.Debug_Client_Lead_Data_Rows, id: \.self) { curr_clientLeadRequest in NavigationLink(curr_clientLeadRequest.Client_Message, value: curr_clientLeadRequest.Client_Message) } } .navigationDestination(for:Debug_Client_Lead_Data.self) { curr_clientLeadRequest in debug_navigation_3_DetailView(rec_id: Int64(curr_clientLeadRequest.id)) } } .onAppear() { Task { await debug_Client_Lead_Data_ListVM.search(rec_id:Int64(0)) //bring all REST API } } } } // data model import Foundation struct Debug_Client_Lead_Data_Response: Decodable { let Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data] private enum CodingKeys: String, CodingKey { case Debug_Client_Lead_Data_Rows = "rows" // root tag: REST API } } struct Debug_Client_Lead_Data: Decodable, Hashable, Identifiable { let id:Int32 let Client_Message: String private enum CodingKeys: String, CodingKey { case id = "id" case Client_Message = "Client_Message" } } //list view model import Foundation @MainActor class Debug_Client_Lead_Data_List_Model: ObservableObject { @Published var Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data_ListViewModel] = [] func search(rec_id:Int64) async { do { let Debug_Client_Lead_Data_Rows = try await Webservice_debug_client_lead_data().getClientLeadRequestSummary(rec_id:rec_id) // '0' optional self.Debug_Client_Lead_Data_Rows = Debug_Client_Lead_Data_Rows.map(Debug_Client_Lead_Data_ListViewModel.init) } catch { print(error) } } } struct Debug_Client_Lead_Data_ListViewModel: Identifiable, Hashable { let debug_Client_Lead_Data: Debug_Client_Lead_Data var id:Int32 { debug_Client_Lead_Data.id } var Client_Message: String { debug_Client_Lead_Data.Client_Message } } //REST API import Foundation class Webservice_debug_client_lead_data { func getClientLeadRequestSummary(rec_id:Int64) async throws -> [Debug_Client_Lead_Data] { var components = URLComponents() components.scheme = Global_REST_API_URL_HTTP components.host = Global_REST_API_URL components.port = Global_REST_API_URL_port components.path = "/GetClientLeadRequest" components.queryItems = [ URLQueryItem(name: "rec_id", value: String(rec_id)) // Optional, pass '0' for all rows ] guard let url = components.url else { throw NetworkError.badURL } let (data, response) = try await URLSession.shared.data(from: url) guard (response as? HTTPURLResponse)?.statusCode == 200 else {throw NetworkError.badID } let Debug_Client_Lead_Data_Response = try? JSONDecoder().decode(Debug_Client_Lead_Data_Response.self, from: data) return Debug_Client_Lead_Data_Response?.Debug_Client_Lead_Data_Rows ?? [] } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
2
Boosts
0
Views
394
Activity
1d
Gesture causing AGGraphGetValue
I have a custom UIGestureRecognizerRepresentable that causes a crash. Only happens about once a week, and that’s with about a thousand times it gets invoked. But it’s persistent and annoying when it happens. The code looks like func handleUIGestureRecognizerAction(_ recognizer: Recognizer, context: Context) { let startLocation = context.converter.convert(globalPoint: recognizer.startLocation, to: coorinateSpace) coorinateSpace is set in init and has crashed on .global, .local, and .named("foo") The convert function gets caught in a AGGraphGetValue loop before finally failing. It has happened while attached to the debugger, but there is not any more information than is in the logs. I don’t even know why it would invoke AttributeGraph in the first place. Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x23aedd1d0 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1eb0cf7dc pthread_kill + 268 2 libsystem_c.dylib 0x197a89c98 abort + 148 3 AttributeGraph 0x1befffef0 AG::precondition_failure(char const*, ...) + 216 4 AttributeGraph 0x1bf000f68 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 936 5 AttributeGraph 0x1beffb2a8 AGGraphGetValue + 232 6 SwiftUICore 0x19626eee8 specialized UnaryLayoutComputer.updateValue() + 92 7 SwiftUICore 0x196bdc9cc specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 24 8 AttributeGraph 0x1bf001914 AG::Graph::UpdateStack::update() + 496 9 AttributeGraph 0x1bf00152c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 352 10 AttributeGraph 0x1bf000e68 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 680 11 AttributeGraph 0x1beffb2a8 AGGraphGetValue + 232 12 SwiftUICore 0x196287604 specialized UnaryChildGeometry.value.getter + 92 13 SwiftUICore 0x196a21bc0 specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 52 14 AttributeGraph 0x1bf001914 AG::Graph::UpdateStack::update() + 496 15 AttributeGraph 0x1bf00152c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 352 16 AttributeGraph 0x1bf000e68 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, unsigned int, AGSwiftMetadata const*, unsigned char&, long) + 680 17 AttributeGraph 0x1beffb2a8 AGGraphGetValue + 232 18 SwiftUICore 0x196a21b28 specialized implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 72 19 AttributeGraph 0x1bf001914 AG::Graph::UpdateStack::update() + 496 20 AttributeGraph 0x1bf00152c AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 352 21 AttributeGraph 0x1beffb560 AG::Graph::value_ref(AG::AttributeID, unsigned int, AGSwiftMetadata const*, unsigned char&) + 296 22 AttributeGraph 0x1beffb2f8 AGGraphGetValue + 312 23 AttributeGraph 0x1bf00206c AGGraphGetInputValue + 60 24 SwiftUICore 0x19626d0a8 GeometryProxy.transform.getter + 220 25 SwiftUICore 0x19699ce80 GeometryProxy.convert<A>(globalPoint:to:) + 76 26 SwiftUI 0x195ddf71c UIGestureRecognizerRepresentableCoordinateSpaceConverter.convert<A>(globalPoint:to:) + 76 27 myapp.debug.dylib 0x1033b3a30 MyAppDragGesture.handleUIGestureRecognizerAction(_:context:) + 1560
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
282
Activity
1d
`FigAudioSession(AV) err=-19224` triggered by empty Button tap on visionOS 26.5, breaking subsequent AVAudioSession configuration
Environment Device: Apple Vision Pro (real device) OS: visionOS 26.5 Xcode: 26.5 Framework: AVFAudio / AVFoundation Summary On visionOS 26.5, tapping an empty Button consistently emits the following internal warning before the action closure executes: <<<< FigAudioSession(AV) >>>> signalled err=-19224 (<>:612) After this warning is emitted, any subsequent call to configure AVAudioSession silently stops working — audio input and output become non-functional for the lifetime of the session. If the same configuration is performed without a preceding button tap (e.g., inside View.task {}), it succeeds and audio works correctly. Reproduction Due to a dependency on LiveKitWebRTC (livekit/webrtc-xcframework) for WebRTC-based Realtime API audio, we are unable to provide a full self-contained sample project. However, the AVAudioSession configuration code involved is as follows: static func configureAudioSession() { #if !os(macOS) do { let audioSession = AVAudioSession.sharedInstance() #if os(tvOS) try audioSession.setCategory(.playAndRecord, options: []) #else try audioSession.setCategory(.playAndRecord, options: [.defaultToSpeaker]) #endif try audioSession.setMode(.videoChat) try audioSession.setActive(true, options: .notifyOthersOnDeactivation) } catch { print("Failed to configure AVAudioSession: \(error)") } #endif } Scenario A — Button tap (fails): Button("Start") { configureAudioSession() // FigAudioSession err=-19224 appears; audio stops working } Scenario B — View.task (succeeds): .task { configureAudioSession() // No warning; audio works correctly } The only difference is whether a user gesture (Button tap) precedes the call. Observed Behavior Tapping any Button on visionOS 26.5 causes FigAudioSession(AV) err=-19224 to be signalled at <>:612, even before the action closure runs. After this warning, AVAudioSession configuration appears to have no effect — setActive(true) does not throw, but audio appears to stop functioning. Configuring the session prior to any button interaction (e.g., in View.task {}) works correctly. Expected Behavior A Button tap should not implicitly interfere with the audio session state. AVAudioSession configuration should succeed regardless of the UI event context that triggers it. Questions What does FigAudioSession(AV) err=-19224 mean? Does it correspond to a documented AVAudioSession.ErrorCode? Why does a Button tap trigger a FigAudioSession signal on visionOS? Is the system performing implicit audio session management when detecting user interaction? Is there a recommended pattern for configuring AVAudioSession in response to a user gesture on visionOS? Our current workaround (View.task {}) is not suitable for on-demand audio start triggered by the user. Is err=-19224 causally responsible for the subsequent audio issue? Since setActive(true) does not throw after the warning, it is unclear whether this signal is the direct cause of the apparent audio failure or a symptom of a deeper conflict. Are there UI components or APIs on visionOS that do not trigger this signal, while still being user-interaction driven? Additional Notes Reproducible only on physical Apple Vision Pro hardware; not observed in Simulator. AirPlay mirroring is not in use during testing. No other apps are playing audio in the background at the time of reproduction. We use LiveKitWebRTC (livekit/webrtc-xcframework, revision 94ce1c9) for WebRTC audio. However, the FigAudioSession warning appears independently of the WebRTC layer — it is emitted on Button tap even before configureAudioSession() is called. We have verified that calling configureAudioSession() before performHandshake() (i.e., before WebRTC initializes its audio pipeline) does not resolve the issue when a Button tap precedes the call.
Replies
0
Boosts
0
Views
66
Activity
2d
Is updateUIViewController always called immediately after makeUIViewController?
I'm in the unenviable position of needing the current UIViewController to keep an external library happy. Essentially, I need to do this in SwiftUI: import LibraryOutOfMyControl ViewControllerReader { viewController in Button("Action") { LibraryOutOfMyControl.action(with: viewController) } } My simple attempt below functions correctly but I'm relying on makeUIViewController always being immediately followed by updateUIViewController. Is the a reasonable assumption or should I set everything up assuming updateUIViewController might never be called? struct ViewControllerReader<Content>: UIViewControllerRepresentable where Content: View { @ViewBuilder var content: (UIViewController) -> Content func makeUIViewController(context: Context) -> UIHostingController<Content> { UIHostingController(rootView: content(UIViewController())) } func updateUIViewController(_ uiViewController: UIHostingController<Content>, context: Context) { uiViewController.rootView = content(uiViewController) uiViewController.view.isUserInteractionEnabled = context.environment.isEnabled } func sizeThatFits(_ proposal: ProposedViewSize, uiViewController: UIHostingController<Content>, context: Context) -> CGSize? { uiViewController.sizeThatFits(in: proposal.replacingUnspecifiedDimensions()) } }
Replies
0
Boosts
0
Views
89
Activity
2d
SwiftUI navigation bar button color changes depending on whether the root view is a ScrollView or VStack
I have a SwiftUI view inside a NavigationStack with a custom navigation bar background color. I want the navigation bar buttons to have a consistent color throughout the app. The issue is that the navigation bar button color changes depending on the first/root view in the body. When the root view is a ScrollView var body: some View { ScrollView { // content } .toolbarBackground(Color(red: 0.02, green: 0.27, blue: 0.13), for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) .toolbarColorScheme(.dark, for: .navigationBar) } The navigation bar buttons appear white. However, if I replace the ScrollView with a VStack, while keeping the same modifiers, the navigation bar buttons appear black: var body: some View { VStack { // content } .toolbarBackground(Color(red: 0.02, green: 0.27, blue: 0.13), for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) .toolbarColorScheme(.dark, for: .navigationBar) } The navigation bar buttons appear black. How can I make the navigation bar buttons stay the same colour in both cases?
Replies
1
Boosts
0
Views
168
Activity
2d
Challenges using SwiftUI views inside an NSToolbarItem
I'm trying to use SwiftUI views inside an NSToolbarItem, and I feel like I'm fighting the system. The goal is to create custom toolbar controls. I don't want AppKit or SwiftUI to recognize that there's a SwiftUI view in the toolbar and then try to style it automatically, which is what I think is happening. Consider this hierarchy: - NSToolbar - NSToolbarItem - view -> MyCustomNSView - addSubview(NSHostingView<CustomView>) So CustomView is inside an NSHostingView, which is inside an NSView, which is assigned to the .view property of an NSToolbarItem. For a while, I struggled to get this working at all because SwiftUI's layout metrics appeared to be affected by safe area insets. SwiftUI's ignoresSafeArea() only seemed to move the problem around. For now, I've disabled full-size content view, which I don't really need anyway. However, a SwiftUI Button or Menu still doesn't behave or style the way I would expect when placed inside an NSToolbarItem. They don't seem to honor many of the styling attributes or view modifiers that work elsewhere. Is there a way to tell AppKit to "ignore" the children of my NSToolbarItem and not apply toolbar-specific styling to them? Am I even correct in thinking that AppKit is recognizing a Button or Menu in the toolbar and forcibly applying styling to it? Previously, I tried implementing my "custom toolbar" entirely outside of NSToolbar, but then SwiftUI struggled with placing views under the transparent, non-existent toolbar. I'd appreciate any direction or hints here. It would be really nice to use SwiftUI for the controls I have in mind, but at the moment I can't get close to the result I'm aiming for.
Replies
0
Boosts
0
Views
92
Activity
2d
.disabled() doesn't VISUALLY disable buttons inside ToolbarItem on iOS 26 devices
[Also submitted as FB19313064] The .disabled() modifier doesn't visually disable buttons inside a ToolbarItem container on iOS 26.0 (23A5297i) devices. The button looks enabled, but tapping it doesn't trigger the action. When deployment target is lowered to iOS 18 and deployed to an iOS 18 device, it works correctly. It still fails on an iOS 26 device, even with an iOS 18-targeted build. This occurs in both the Simulator and on a physical device. Screen Recording Code struct ContentView: View { @State private var isButtonDisabled = false private var osTitle: String { let version = ProcessInfo.processInfo.operatingSystemVersion return "iOS \(version.majorVersion)" } var body: some View { NavigationStack { VStack { Button("Body Button") { print("Body button tapped") } .buttonStyle(.borderedProminent) .disabled(isButtonDisabled) Toggle("Disable buttons", isOn: $isButtonDisabled) Spacer() } .padding() .navigationTitle("Device: \(osTitle)") .navigationBarTitleDisplayMode(.large) .toolbar { ToolbarItem { Button("Toolbar") { print("Toolbar button tapped") } .buttonStyle(.borderedProminent) .disabled(isButtonDisabled) } } } } }
Replies
8
Boosts
3
Views
709
Activity
3d
SwiftUI Button with Image view label has smaller hit target
[Also submitted as FB20213961] SwiftUI Button with a label: closure containing only an Image view has a smaller tap target than buttons created with a Label or the convenience initializer. The hit area shrinks to the image bounds instead of preserving the standard minimum tappable size. SCREEN RECORDING On a physical device, the difference is obvious—it’s easy to miss the button. Sometimes it even shows the button-tapped bounce animation but doesn’t trigger the action. SYSTEM INFO Xcode Version 26.0 (17A321) macOS 15.6.1 (24G90) iOS 26.0 (23A340) SAMPLE CODE The following snippet shows the difference in hit targets between the convenience initializer, a Label, and an Image (the latter two in a label: closure). // ✅ Hit target is entire button Button("Button 1", systemImage: "1.square.fill") { print("Button 1 tapped") } // ✅ Hit target is entire button Button { print("Button 2 tapped") } label: { Label("Button 2", systemImage: "2.square.fill") } // ❌ Hit target is smaller than button Button { print("Button 3 tapped") } label: { Image(systemName: "3.square.fill") }
Replies
6
Boosts
4
Views
456
Activity
3d
Changing systemImage value for Image, logs "fopen failed for data file".
I'm getting a log error and a slight delay in the UI when displaying a system image that changes at the end of a sequence. I'm using a ternary operator to determine the image; the fact that the image changes seem to be the issue, rather than the value itself. The issue only occurs for a newly installed app, and not when the app is rerun. (I'm using similar code to display an onboarding sequence after installation.) This happens on device (iphone 15 pro v25.6) and simulator (iphone 17 pro v25.6 and iphone 16 pro v18.5); xcode 26.5 (17F42). Console errors (device and iphone 17 simulator): fopen failed for data file: errno = 2 (No such file or directory) fopen failed for data file: errno = 2 (No such file or directory) Repro Code: import SwiftUI struct ContentView: View { // NOTE: error only occurs with new install. @State private var currentItem = 0 @State private var totalItems: Int = 4 var body: some View { VStack(spacing: 0) { Spacer() Text("totalItems: \(totalItems)") TabView(selection: $currentItem) { ForEach(0...totalItems, id: \.self) { item in Text("\(item) ~ \(currentItem)") .tag(item) } } //TV .tabViewStyle(.page(indexDisplayMode: .never)) .frame(height: 200) Button { if currentItem < totalItems { currentItem += 1 currentItem = min(totalItems, currentItem) } } label: { let imgString: String = (currentItem == totalItems ? "arrowshape.turn.up.right" : "arrowshape.right") // error // let imgString: String = ((currentItem == totalItems) ? "x.circle" : "smallcircle.filled.circle") // error // let imgString: String = "smallcircle.filled.circle" // no error // let imgString: String = "x.circle" // no error Text("\(imgString)") // if only print text, no error, so issue seems to be with Image. Image(systemName: imgString) } Spacer() } } } Click through the button sequence to see issue at end of sequence. Uncomment the various imgString lines to see indicated differences in behavior. Need to delete app each time to repro issue. Running in simulator on iphone 16 Pro iOS 18.5 has slightly different error messages: fopen failed for data file: errno = 2 (No such file or directory) Errors found! Invalidating cache... fopen failed for data file: errno = 2 (No such file or directory) Errors found! Invalidating cache...
Replies
1
Boosts
0
Views
49
Activity
3d
LiveActivity via Push-To-Start and Update token questions.
We are implementing starting an activity via Push-To-Start. For the most part it works great, however we have run into a few edge cases. Currently, we send the "start activity" push notification and it creates the Activity as expected. If the app doesn't send an update token w/in a configured time, we assume the activity didn't start and try to start the activity again. Occasionally we get into a situation where there have been multiple activities started, but it should really only be one. Here is my theory: We store an auth token in the keychain for all REST endpoints if the phone has been restarted and not unlocked, the app doesn't have access to the auth token and fails to send the update token to our backend. Are there any best practices on how to manage PTS and UPDATE tokens? (updating these w/o authentication seems problematic)
Replies
1
Boosts
0
Views
281
Activity
4d
FamilyActivityPicker missing search bar when embedded inline on iPad
When FamilyActivityPicker is used as an embedded view (not via the .familyActivityPicker sheet modifier), the search bar that normally appears at the bottom is not rendered on iPad. The same code shows the search bar correctly on iPhone. Environment Frameworks: SwiftUI, FamilyControls Device: iPad (reproduces on multiple models / iPadOS versions — 26.2, 26.5) iPhone: search bar appears as expected Usage The picker is placed directly inside a SwiftUI view hierarchy: import SwiftUI import FamilyControls struct ContentView: View { @State private var selection = FamilyActivitySelection() var body: some View { FamilyActivityPicker(selection: $selection) } } Expected A search field is visible at the bottom of the sheet (same as iPhone), allowing the user to search for apps/categories/websites. Actual On iPad, no search field is rendered. The picker only shows the category/app list. There is no way to search. Notes I would like the embedded FamilyActivityPicker to show the same search affordance on iPad that it shows on iPhone, so apps that rely on custom surrounding UI don't have to give it up to gain search.
Replies
1
Boosts
0
Views
143
Activity
5d
Search Functionality Missing in FamilyActivityPicker on iPadOS 26.0+
Issue: The search functionality in FamilyActivityPicker has disappeared on iPadOS 26.0+. This feature was working in previous versions but is now missing. Framework: FamilyControls Expected: Search bar should be available in FamilyActivityPicker to help users find apps quickly. Actual: Search functionality is completely missing. Impact: Makes app selection difficult for users with many installed apps. Is this a known issue? If it's a bug, please address it in an upcoming update. If intentional, guidance on alternatives would be appreciated. Thank you.
Replies
2
Boosts
1
Views
175
Activity
5d
ControlCenter blocks a MenuBarExtra item due to foreign trackedApplications entry
I am seeing a reproducible issue with macOS ControlCenter's per-app menu bar tracking state in a SwiftUI MenuBarExtra app. On launch the app creates its menu bar status item. ControlCenter then reads group.com.apple.controlcenter / trackedApplications, moves the app's status item host to the blocked list, sends NSStatusItemChangeVisibilityAction with visibility=0, and the app terminates because its only status item is removed. Two observations: Changing only the bundle identifier makes the menu bar item appear normally. In trackedApplications, the affected app has its own entry with isAllowed: true; a separate entry for another app has isAllowed: false, and that disallowed foreign entry's menuItemLocations contained an entry referencing the affected app. Removing only the affected app's reference from the other app's disallowed entry fixed the issue: the app launched normally, and ControlCenter no longer sent visibility=0. ControlCenter appears to associate one app's menu item identity with another app's disallowed tracked record, letting the foreign blocked record override the app's own allowed record. Is this expected? And is there a supported way to reset this per-app ControlCenter menu bar state without editing the protected group.com.apple.controlcenter plist directly? Testing Environment: macOS 26.3 (25D125) Xcode 26.3 (17C529) LSUIElement: true Sandboxed app SwiftUI MenuBarExtra Relevant log pattern: Host properties initialized; (bid:[AffectedApp]-Item-0-[pid]) State(applicationItem: true, clientRequestsVisibility: true, neverClip: false) looked up value <private> for key trackedApplications (Domain: group.com.apple.controlcenter) Moving host to blocked list; (bid:[AffectedApp]-Item-0-[pid]) Requesting blocked host to not be visible; (bid:[AffectedApp]-Item-0-[pid]) Sending action(s): <NSStatusItemChangeVisibilityAction: ...> Received action(s): NSStatusItemChangeVisibilityAction 0 agent requesting visibility=0 temporary=0 0 terminating on removal
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
0
Boosts
0
Views
224
Activity
1w
Need behaviour of iOS 26 tab bar view and sheet view similar to Preview app.
Hi all, I was trying to have a UI similar to Preview app which we have in iPhone. We have a tab bar view and behind it, we have a sheet view. I was trying to achieve that, but the .sheet modifier covers the bottom tab bar view.
Replies
1
Boosts
0
Views
57
Activity
1w
Tab button's ax identifier is missing when using `.sidebarAdaptable` TabViewStyle
Hello, I found that if you apply the new .sidebarAdaptable tab view style, the accessibility identifiers of tab bar buttons are missing. import SwiftUI struct ContentView: View { var body: some View { TabView { Tab("Received", systemImage: "tray.and.arrow.down.fill") { Text("Received") } .accessibilityIdentifier("tab.received") // 👀 Tab("Sent", systemImage: "tray.and.arrow.up.fill") { Text("Sent") } .accessibilityIdentifier("tab.sent") // 👀 Tab("Account", systemImage: "person.crop.circle.fill") { Text("Account") } .accessibilityIdentifier("tab.account") // 👀 } .tabViewStyle(.sidebarAdaptable) // 👈 if remove this, ax identifiers are ok } } #Preview { ContentView() } The identifiers automatically appear after a few seconds. But this behaviour breaks a lot of the UI test cases.
Replies
3
Boosts
0
Views
643
Activity
1w
Popover in Toolbar Causes Crash in Catalyst App on macOS 26
Hi everyone, I’ve encountered an issue where using a popover inside the toolbar of a Catalyst app causes a crash on macOS 26 beta 5 with Xcode 26 beta 5. Here’s a simplified code snippet: import SwiftUI struct ContentView: View { @State private var isPresentingPopover = false var body: some View { NavigationStack { VStack { } .padding() .toolbar { ToolbarItem { Button(action: { isPresentingPopover.toggle() }) { Image(systemName: "bubble") } .popover(isPresented: $isPresentingPopover) { Text("Hello") .font(.largeTitle) .padding() } } } } } } Steps to reproduce: Create a new iOS app using Xcode 26 beta 5. Enable Mac Catalyst (Match iPad). Add the above code to show a Popover from a toolbar button. Run the app on macOS 26, then click the toolbar button. The app crashes immediately upon clicking the toolbar button. Has anyone else run into this? Any workarounds or suggestions would be appreciated! Thanks!
Replies
6
Boosts
2
Views
600
Activity
1w
Glass effect interactive effect issue when used with concentric shapes
Using .glassEffect(.clear.interactive(), in: shape), where shape is some concentric shape that adapts to corner radius of the device, results in appearing of highlighted capsule shape. Code to reproduce this behavior import SwiftUI struct HelloLiquidGlass: View { var body: some View { if #available(iOS 26.0, *) { Text("Hello, World!") .frame(maxWidth: .infinity, maxHeight: .infinity) // .glassEffect(.clear.interactive(), in: .rect(corners: .concentric)) // .glassEffect(.clear.interactive(), in: ConcentricRectangle(uniformTopCorners: .fixed(80))) .padding(36) .ignoresSafeArea() .preferredColorScheme(.dark) } } } #Preview { HelloLiquidGlass() } Either of both commented-out modifiers produces the same result when user interacts with Liquid Glass pane (revealing of capsule shape that is not relative to actual shape of liquid glass effect modifier) iOS 26.5 (23F73) SDK + iOS 26.5 (23F77) Simulator
Replies
3
Boosts
0
Views
293
Activity
1w