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

SecureField dots invisible in dark mode when iOS suggests and fills a strong password
I am using SwiftUI's native SecureField. When a user types their password manually, the dots render correctly in both light and dark mode. However, when iOS suggests and autofills a strong generated password, the dots become invisible in dark mode. Switching to light mode shows that they are there. Is there a supported way to force SecureField to re-render its secure entry dots correctly after iOS fills in a strong generated password in dark mode? import SwiftUI let warmMustard = Color(red: 0.780, green: 0.659, blue: 0.290) let lightText = Color(red: 0.973, green: 0.961, blue: 0.933) let darkText = Color(red: 0.118, green: 0.118, blue: 0.118) struct SecureFieldTestView: View { @Environment(\.colorScheme) var colorScheme @State private var username = "" @State private var password = "" @State private var confirmPassword = "" var body: some View { ZStack { Color(colorScheme == .dark ? UIColor.black : UIColor.white) .ignoresSafeArea() VStack(spacing: 20) { Text("Dark mode dot reproduction") .foregroundColor(colorScheme == .dark ? .white : .black) TextField("Username", text: $username) .textContentType(.username) .autocorrectionDisabled() .textInputAutocapitalization(.never) .padding() .background(colorScheme == .dark ? Color.black : Color.white) .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) .overlay(RoundedRectangle(cornerRadius: 8).stroke(warmMustard, lineWidth: 2)) SecureField("Password", text: $password) .textContentType(.newPassword) .padding() .background(colorScheme == .dark ? Color.black : Color.white) .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) .overlay(RoundedRectangle(cornerRadius: 8).stroke(warmMustard, lineWidth: 2)) SecureField("Confirm Password", text: $confirmPassword) .textContentType(.newPassword) .padding() .background(colorScheme == .dark ? Color.black : Color.white) .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) .overlay(RoundedRectangle(cornerRadius: 8).stroke(warmMustard, lineWidth: 2)) } .padding(.horizontal, 32) } } } #Preview { SecureFieldTestView() }
2
0
74
3d
How to set the Locale.current to be same as the Environment locale?
I have this code As you can see, the locale of the Environment is different from the Locale given by .current. This is a problem for me because I have code that uses String(localized:) and AttributedString. I would like to be able to preview them with the locale I set in the Environment without any additional work on my part. I assumed these Apis would use the locale set by the environment but no, it uses the locale as decided by the schema used to build the preview app. The current solution I have is to manually change the App Language in the Preview's scheme to be whatever I need to correctly localize the language in Preview.
1
0
65
3d
How to handle PhotosPicker selected changed msg?
@State private var selectedItems:[PhotosPickerItem] = [] { didSet { print("items changed.") } } ... PhotosPicker( selection: $selectedItems, matching: .images, ) { Text("select pictures") } I want to know selectedItem changed, but didSet of selectedItems is not work. Is there any other way to inform me: Has the user selected some pictures? I want to create a task to load picture and display them to view after user selected some picture. Thank you.
Topic: UI Frameworks SubTopic: SwiftUI
1
0
73
3d
AttributedString Localization does not seem to work
I have this code struct TestAppleSuggestion: View { @Environment(\.locale) var locale: Locale var body: some View { VStack { VStack { Text("locale: \(locale.identifier)") Text(AttributedString(localized: LocalizedStringResource( "welcome", locale: locale ))) Text(AttributedString(localized: "welcome", locale: locale )) } } } } #Preview { TestAppleSuggestion().environment(\.locale, Locale(identifier: "fr-CA")) } Heres What I see in SwiftUi Previews The Localization is working for the LocalizedStringResource but not to the AttributedString. Why?
3
0
180
3d
.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
5
0
204
1d
DisclosureGroup chevron no longer responds to tint color
I’m using a standard DisclosureGroup in SwiftUI and noticed that the disclosure indicator (chevron) no longer adopts the tint color. Example: DisclosureGroup("Details") { Text("Content") } .tint(.indigo) The label text becomes indigo, but the chevron remains the default system color. I also tried creating a custom DisclosureGroupStyle to render my own chevron, but that approach appears to break some of the built-in disclosure animation behavior and interaction. Questions: Is there a supported way to customize the disclosure indicator color in DisclosureGroup? Has the behavior of .tint(_:) changed for DisclosureGroup in recent iOS releases? If customization is not currently supported, is there a recommended alternative that preserves the native disclosure animations and accessibility behavior? Tested on: iOS 26.3 and Xcode 26.3
1
0
137
3d
iOS 26: Enabling "Reduce Transparency" causes a persistent white bar where the tab bar was hidden, blocking user interaction
Hi everyone, We're experiencing a bug on iOS 26 that only occurs when the user has Reduce Transparency enabled in Accessibility settings. App structure: Our app uses a TabView with a standard tab bar. Inside each tab, we use a NavigationStack. The tab bar is visible on root-level screens, and hidden on all pushed destinations using: .toolbar(.hidden, for: .tabBar) The problem: On iOS 26 with Reduce Transparency off (Liquid Glass active) — everything works correctly. The tab bar hides as expected. On iOS 26 with Reduce Transparency on — a white bar appears at the bottom of the screen in every place where the tab bar is hidden. This white bar: Overlaps content at the bottom of the screen. Blocks scroll, tap, and all user interactions in that area. We also tried: .toolbarBackground(.hidden, for: .tabBar) Removing all custom UITabBarAppearance configuration The only workaround we found is setting UIDesignRequiresCompatibility = YES in Info.plist, which reverts the entire app to the pre-iOS 26 design — not a viable long-term solution. What can we do? Thanks in advance.
2
0
144
2d
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
154
1w
`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
119
1w
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
110
1w
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
121
1w
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
190
1w
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
70
1w
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
171
1w
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
238
2w
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
344
1w
SwiftUI Liquid Glass Menu briefly turns black after dismissing before returning to transparent glass
Hi, I’m seeing a visual issue with a SwiftUI Menu styled with Liquid Glass on iOS 26. I have a top bar control where a Menu is inside a GlassEffectContainer. The menu label uses .glassEffect(.regular.interactive()), glassEffectID, and glassEffectUnion. The control normally looks translucent, matching the background correctly. But when I open the menu and then dismiss it, the glass control briefly becomes solid black for a moment before returning to the expected transparent/glass appearance. This is visible especially on a colorful/blurred background: Before opening the menu: the control is transparent Liquid Glass. Open the SwiftUI Menu. Dismiss the menu. The menu label/control briefly renders as a black pill. After a short delay, it returns to the correct transparent glass style. Here is the simplified structure: @Namespace private var namespace GlassEffectContainer(spacing: 18) { VStack(spacing: 4) { Menu { Button { selectedMode = .automatic } label: { Label("Automatic", systemImage: "wand.and.sparkles") } Button { selectedMode = .instant } label: { Label("Instant", systemImage: "bolt.fill") } Button { selectedMode = .thinking } label: { Label("Thinking", systemImage: "brain.head.profile") } Divider() Button { showSettings = true } label: { Label("Configure", systemImage: "slider.horizontal.3") } } label: { HStack(spacing: 8) { Image(systemName: selectedMode.icon) Text(selectedMode.title) Image(systemName: "chevron.down") } .padding(.horizontal, 16) .frame(minWidth: 92, minHeight: 48) .contentShape(RoundedRectangle(cornerRadius: 24, style: .continuous)) } } .glassEffect(.regular.interactive(), in: RoundedRectangle(cornerRadius: 24, style: .continuous)) .glassEffectUnion(id: "smart-intelligence-connected-menu", namespace: namespace) .glassEffectID("smart-intelligence-menu-pill", in: namespace) .buttonStyle(.plain) .labelStyle(.iconOnly) } I also tried applying .buttonStyle(.glass) directly to the Menu, and tried moving the glass effect between the Menu label and the wrapper VStack. The issue still appears: after dismissing the menu, the glass label briefly falls back to a solid black appearance before the transparent glass effect recovers. Is this expected behavior for SwiftUI.Menu with Liquid Glass, or is there a recommended way to avoid this black flash after menu dismissal? Should Menu labels avoid .glassEffect(.regular.interactive()) / GlassEffectContainer, or is there a different modifier order recommended for iOS 26? Thanks for reply.
2
1
267
1d
Textfield with both a formatter and axis
Hi, is there any textfield init with both formatter and axis for multiline? I notice the there are both an init to include a formatter like so: init(_:value:formatter:prompt:) and another one to include an axis for multiline like so: init(_:text:prompt:axis:). Is there any that can be used to set both of them? If not, is there any workaround? Because I happen to need both of them. Thank you.
1
0
127
2w
SecureField dots invisible in dark mode when iOS suggests and fills a strong password
I am using SwiftUI's native SecureField. When a user types their password manually, the dots render correctly in both light and dark mode. However, when iOS suggests and autofills a strong generated password, the dots become invisible in dark mode. Switching to light mode shows that they are there. Is there a supported way to force SecureField to re-render its secure entry dots correctly after iOS fills in a strong generated password in dark mode? import SwiftUI let warmMustard = Color(red: 0.780, green: 0.659, blue: 0.290) let lightText = Color(red: 0.973, green: 0.961, blue: 0.933) let darkText = Color(red: 0.118, green: 0.118, blue: 0.118) struct SecureFieldTestView: View { @Environment(\.colorScheme) var colorScheme @State private var username = "" @State private var password = "" @State private var confirmPassword = "" var body: some View { ZStack { Color(colorScheme == .dark ? UIColor.black : UIColor.white) .ignoresSafeArea() VStack(spacing: 20) { Text("Dark mode dot reproduction") .foregroundColor(colorScheme == .dark ? .white : .black) TextField("Username", text: $username) .textContentType(.username) .autocorrectionDisabled() .textInputAutocapitalization(.never) .padding() .background(colorScheme == .dark ? Color.black : Color.white) .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) .overlay(RoundedRectangle(cornerRadius: 8).stroke(warmMustard, lineWidth: 2)) SecureField("Password", text: $password) .textContentType(.newPassword) .padding() .background(colorScheme == .dark ? Color.black : Color.white) .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) .overlay(RoundedRectangle(cornerRadius: 8).stroke(warmMustard, lineWidth: 2)) SecureField("Confirm Password", text: $confirmPassword) .textContentType(.newPassword) .padding() .background(colorScheme == .dark ? Color.black : Color.white) .cornerRadius(8) .foregroundColor(colorScheme == .dark ? .white : .black) .overlay(RoundedRectangle(cornerRadius: 8).stroke(warmMustard, lineWidth: 2)) } .padding(.horizontal, 32) } } } #Preview { SecureFieldTestView() }
Replies
2
Boosts
0
Views
74
Activity
3d
How to set the Locale.current to be same as the Environment locale?
I have this code As you can see, the locale of the Environment is different from the Locale given by .current. This is a problem for me because I have code that uses String(localized:) and AttributedString. I would like to be able to preview them with the locale I set in the Environment without any additional work on my part. I assumed these Apis would use the locale set by the environment but no, it uses the locale as decided by the schema used to build the preview app. The current solution I have is to manually change the App Language in the Preview's scheme to be whatever I need to correctly localize the language in Preview.
Replies
1
Boosts
0
Views
65
Activity
3d
How to handle PhotosPicker selected changed msg?
@State private var selectedItems:[PhotosPickerItem] = [] { didSet { print("items changed.") } } ... PhotosPicker( selection: $selectedItems, matching: .images, ) { Text("select pictures") } I want to know selectedItem changed, but didSet of selectedItems is not work. Is there any other way to inform me: Has the user selected some pictures? I want to create a task to load picture and display them to view after user selected some picture. Thank you.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
73
Activity
3d
AttributedString Localization does not seem to work
I have this code struct TestAppleSuggestion: View { @Environment(\.locale) var locale: Locale var body: some View { VStack { VStack { Text("locale: \(locale.identifier)") Text(AttributedString(localized: LocalizedStringResource( "welcome", locale: locale ))) Text(AttributedString(localized: "welcome", locale: locale )) } } } } #Preview { TestAppleSuggestion().environment(\.locale, Locale(identifier: "fr-CA")) } Heres What I see in SwiftUi Previews The Localization is working for the LocalizedStringResource but not to the AttributedString. Why?
Replies
3
Boosts
0
Views
180
Activity
3d
.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
5
Boosts
0
Views
204
Activity
1d
DisclosureGroup chevron no longer responds to tint color
I’m using a standard DisclosureGroup in SwiftUI and noticed that the disclosure indicator (chevron) no longer adopts the tint color. Example: DisclosureGroup("Details") { Text("Content") } .tint(.indigo) The label text becomes indigo, but the chevron remains the default system color. I also tried creating a custom DisclosureGroupStyle to render my own chevron, but that approach appears to break some of the built-in disclosure animation behavior and interaction. Questions: Is there a supported way to customize the disclosure indicator color in DisclosureGroup? Has the behavior of .tint(_:) changed for DisclosureGroup in recent iOS releases? If customization is not currently supported, is there a recommended alternative that preserves the native disclosure animations and accessibility behavior? Tested on: iOS 26.3 and Xcode 26.3
Replies
1
Boosts
0
Views
137
Activity
3d
iOS 26: Enabling "Reduce Transparency" causes a persistent white bar where the tab bar was hidden, blocking user interaction
Hi everyone, We're experiencing a bug on iOS 26 that only occurs when the user has Reduce Transparency enabled in Accessibility settings. App structure: Our app uses a TabView with a standard tab bar. Inside each tab, we use a NavigationStack. The tab bar is visible on root-level screens, and hidden on all pushed destinations using: .toolbar(.hidden, for: .tabBar) The problem: On iOS 26 with Reduce Transparency off (Liquid Glass active) — everything works correctly. The tab bar hides as expected. On iOS 26 with Reduce Transparency on — a white bar appears at the bottom of the screen in every place where the tab bar is hidden. This white bar: Overlaps content at the bottom of the screen. Blocks scroll, tap, and all user interactions in that area. We also tried: .toolbarBackground(.hidden, for: .tabBar) Removing all custom UITabBarAppearance configuration The only workaround we found is setting UIDesignRequiresCompatibility = YES in Info.plist, which reverts the entire app to the pre-iOS 26 design — not a viable long-term solution. What can we do? Thanks in advance.
Replies
2
Boosts
0
Views
144
Activity
2d
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
154
Activity
1w
`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
119
Activity
1w
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
110
Activity
1w
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
121
Activity
1w
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
190
Activity
1w
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
70
Activity
1w
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
171
Activity
1w
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
238
Activity
2w
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
344
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
64
Activity
2w
SwiftUI Liquid Glass Menu briefly turns black after dismissing before returning to transparent glass
Hi, I’m seeing a visual issue with a SwiftUI Menu styled with Liquid Glass on iOS 26. I have a top bar control where a Menu is inside a GlassEffectContainer. The menu label uses .glassEffect(.regular.interactive()), glassEffectID, and glassEffectUnion. The control normally looks translucent, matching the background correctly. But when I open the menu and then dismiss it, the glass control briefly becomes solid black for a moment before returning to the expected transparent/glass appearance. This is visible especially on a colorful/blurred background: Before opening the menu: the control is transparent Liquid Glass. Open the SwiftUI Menu. Dismiss the menu. The menu label/control briefly renders as a black pill. After a short delay, it returns to the correct transparent glass style. Here is the simplified structure: @Namespace private var namespace GlassEffectContainer(spacing: 18) { VStack(spacing: 4) { Menu { Button { selectedMode = .automatic } label: { Label("Automatic", systemImage: "wand.and.sparkles") } Button { selectedMode = .instant } label: { Label("Instant", systemImage: "bolt.fill") } Button { selectedMode = .thinking } label: { Label("Thinking", systemImage: "brain.head.profile") } Divider() Button { showSettings = true } label: { Label("Configure", systemImage: "slider.horizontal.3") } } label: { HStack(spacing: 8) { Image(systemName: selectedMode.icon) Text(selectedMode.title) Image(systemName: "chevron.down") } .padding(.horizontal, 16) .frame(minWidth: 92, minHeight: 48) .contentShape(RoundedRectangle(cornerRadius: 24, style: .continuous)) } } .glassEffect(.regular.interactive(), in: RoundedRectangle(cornerRadius: 24, style: .continuous)) .glassEffectUnion(id: "smart-intelligence-connected-menu", namespace: namespace) .glassEffectID("smart-intelligence-menu-pill", in: namespace) .buttonStyle(.plain) .labelStyle(.iconOnly) } I also tried applying .buttonStyle(.glass) directly to the Menu, and tried moving the glass effect between the Menu label and the wrapper VStack. The issue still appears: after dismissing the menu, the glass label briefly falls back to a solid black appearance before the transparent glass effect recovers. Is this expected behavior for SwiftUI.Menu with Liquid Glass, or is there a recommended way to avoid this black flash after menu dismissal? Should Menu labels avoid .glassEffect(.regular.interactive()) / GlassEffectContainer, or is there a different modifier order recommended for iOS 26? Thanks for reply.
Replies
2
Boosts
1
Views
267
Activity
1d
How to disable multiple windows feature of my App on iPadOS?
My app is a SwiftUI lifecycle app. I want to disable its multiple windows feature on iPadOS . I have tried to set the Enable Multiple Scenes option to false in Application Scene Manifest, but it doesn't work.
Replies
0
Boosts
0
Views
167
Activity
2w
Textfield with both a formatter and axis
Hi, is there any textfield init with both formatter and axis for multiline? I notice the there are both an init to include a formatter like so: init(_:value:formatter:prompt:) and another one to include an axis for multiline like so: init(_:text:prompt:axis:). Is there any that can be used to set both of them? If not, is there any workaround? Because I happen to need both of them. Thank you.
Replies
1
Boosts
0
Views
127
Activity
2w