Search results for

“swiftui”

17,491 results found

Post

Replies

Boosts

Views

Activity

.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 bo
Topic: UI Frameworks SubTopic: SwiftUI
6
0
371
Jun ’26
Reply to Xcode Accessibility Inspector incorrectly claims Dynamic Type font sizes are unsupported.
Thanks for the post. This is one that I’m sure many developers here would like to see it on a focused sample project. Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project. Would be great to see those warnings and see how it behaves. The Accessibility Inspector when it runs an audit for Dynamic Type, it looks at the underlying accessibility elements and checks for specific UIKit properties, specifically, whether adjustsFontForContentSizeCategory is set to true on a UILabel or UITextView. SwiftUI, however, handles text rendering and accessibility tree generation differently. It abstracts the text drawing, and the synthesized SwiftUI.AccessibilityNode exposed to the Inspector does not always pass along that specific UIKit-level flag in a way the older audit heuristics expect. If you are
Jun ’26
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
308
Jun ’26
Reply to Swift compiler error when using DeclaredAgeRange with swift 6
It’s hard to investigate Swift concurrency problems without knowing more about your build environment, so I tried reproducing this here in my office: Using Xcode 26.5, I created a new project from the iOS > App template. I changed it to use the Swift 6 language mode. I changed ContentView.swift to this: import SwiftUI /* @preconcurrency */ import DeclaredAgeRange struct ContentView: View { @Environment(.requestAgeRange) var requestAgeRange var body: some View { VStack { Button(Test) { Task { do { let response = try await requestAgeRange(ageGates: 13, 15, 18) // ^ // Sending value of non-Sendable type 'DeclaredAgeRangeAction' risks // causing data races // // Sending main actor-isolated value of non-Sendable type // 'DeclaredAgeRangeAction' to @concurrent instance method // 'callAsFunction(ageGates:_:_:)' risks causing races in between // main actor-isolated and @concurrent uses print(response) } catch { } } } } .padding() } } #Preview { ContentView() } I think this accurately reflects the error yo
Jun ’26
Individual enrolment stuck at "ID Verification Rejected" — no detail surfaced, support silent past SLA
Hi all, Hoping someone has hit and resolved this exact pattern, or can point me to the right escalation path. I'm trying to enrol in the Apple Developer Program as an Individual (Bengaluru, India). The Apple Developer iOS app shows ID Verification Rejected under the Apple Developer Program status — but with no specific reason and no retry button. The app does not surface what was actually wrong with the verification. What I have already done: Confirmed my Apple Account name (Adarsh P S) exactly matches my Passport and PAN card (no extra spaces, correct initials). Opened Developer Support case #102900128848 — the agent replied once on 2026-05-28 asking for a screenshot, which I provided the same day. No follow-up in 3+ business days. Filed a parallel case #102905434551 on 2026-06-02 explicitly referencing the first as escalation, not a duplicate. Apple ID has 2FA enabled, trusted device active, billing address on file. Questions for anyone who has gotten past this: Did the verification reset come from support,
12
0
1.7k
Jun ’26
(Air)Printing from JavaScript in Safari?
Is there any documentation or advice on printing from a Safari webapp (in JavaScript)? My app needs to print labels, and printing from Safari presents few options. For example, you can't turn off backgrounds or the URL/date/time footer. And it wants to print a full-size page, which ends up printing miles of label. (I've also tried printing from SwiftUI on a macOS app, and even that is just terrible to try to get right. Why is printing so hard?)
0
0
898
May ’26
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
0
0
349
May ’26
Reply to Gesture causing AGGraphGetValue
Hi @rahmcoff, This is not a bug in the convert call itself — it's a re-entrancy / lifetime problem with the Context's coordinate-space converter. The crash happens because context.converter.convert(globalPoint:to:) ends up reading a SwiftUI GeometryProxy/UnaryLayoutComputer value out of the AttributeGraph, and the attribute it tries to read is being evaluated at a moment when its dependencies are not in a valid, resolved state. One thing to keep in mind is that AG::precondition_failure → abort() is AttributeGraph's way of saying you asked the graph for a value while the graph was mid-update or the node has been invalidated. The reason this abort() is intermittent (~1 in 1000) is that it only triggers when the gesture action fires while a layout pass affecting that representable is in flight, or after the view providing that coordinate space has been removed/recycled. I'd suggest you consider one of the following options: The code captures coordinateSpace (or the converter) and are using it at the wro
Topic: UI Frameworks SubTopic: SwiftUI
May ’26
Reply to How to trigger hover events in UI in RealityView 3D space
Hi @MaoChao The closure passed to hoverEffect is a builder, not an event handler. SwiftUI calls it to construct the visual effect for each phase. You should return a modified effect based on isActive, not run side effects like print inside it. Note: visionOS does not deliver gaze-hover events to your app. Eye input is private, so there is no callback that fires when people look at your view. Fix: usehoverEffect only for visuals, and a Button action (or onTapGesture) for logic: Button(Hover to scale) { } .hoverEffect { effect, isActive, _ in effect.scaleEffect(isActive ? 1.1 : 1.0) }
May ’26
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: UIViewControllerRepresentable where Content: View { @ViewBuilder var content: (UIViewController) -> Content func makeUIViewController(context: Context) -> UIHostingController { UIHostingController(rootView: content(UIViewController())) } func updateUIViewController(_ uiViewController: UIHostingController, context: Context) { uiViewController.rootView = content(uiViewController) uiViewController.view.isUserInteractionEnabled
0
0
183
May ’26
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) 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 h
0
0
331
May ’26
SwiftData crash on new property (Could not cast...)
I have a small example where adding a new property to a persisted Codable struct causes a crash on launch instead of decoding the missing property using its default value. Steps Run this app once and press Insert Event to persist data: import SwiftUI import SwiftData @main struct SwiftDataCrash: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: Event.self) } } struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var events: [Event] var body: some View { VStack(spacing: 12) { Text(Events: (events.count)) Button(Insert Event) { let event = Event( recurrence: Recurrence( interval: 1 ) ) modelContext.insert(event) try? modelContext.save() } List(events) { event in Text(String(describing: event.recurrence)) } } .padding() } } @Model final class Event { var recurrence: Recurrence? = nil init(recurrence: Recurrence? = nil) { self.recurrence = recurrence } } struct Recurrence: Codable { var interval: Int // STEP 2: // After first run + i
2
0
886
May ’26
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
1
0
291
May ’26
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)
1
0
189
May ’26
Unintended X-axis layout shift of a Button when sibling views animate and keyboard appears
Hello everyone, My name is Keita Tomizu. I'm a university student in Japan, currently developing a personal app. I am facing a tricky SwiftUI layout issue that I have spent hours trying to solve, and I would really appreciate your insights. Context & Goal: I have an overlay UI layer (zIndex(4)) consisting of a VStack that contains top and bottom HStacks. • In the top-left, there is a back button (<). • In the top-right and bottom-right, there are action buttons. • When a user taps the bottom-right button, a state isShowingAddView becomes true. This brings up a keyboard and a custom view in the background. • My Goal: When isShowingAddView is true, the right-side buttons should scale up and fade out (opacity to 0) in place. The top-left < button should remain completely static and anchored in its exact position. The Issue: When the state toggles, the < button unexpectedly shifts horizontally (along the X-axis) and sometimes behaves erratically, moving off-screen or losing its static positi
Topic: Design SubTopic: General
0
0
1.4k
May ’26
.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 bo
Topic: UI Frameworks SubTopic: SwiftUI
Replies
6
Boosts
0
Views
371
Activity
Jun ’26
Reply to Xcode Accessibility Inspector incorrectly claims Dynamic Type font sizes are unsupported.
Thanks for the post. This is one that I’m sure many developers here would like to see it on a focused sample project. Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project. Would be great to see those warnings and see how it behaves. The Accessibility Inspector when it runs an audit for Dynamic Type, it looks at the underlying accessibility elements and checks for specific UIKit properties, specifically, whether adjustsFontForContentSizeCategory is set to true on a UILabel or UITextView. SwiftUI, however, handles text rendering and accessibility tree generation differently. It abstracts the text drawing, and the synthesized SwiftUI.AccessibilityNode exposed to the Inspector does not always pass along that specific UIKit-level flag in a way the older audit heuristics expect. If you are
Replies
Boosts
Views
Activity
Jun ’26
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
308
Activity
Jun ’26
Reply to Swift compiler error when using DeclaredAgeRange with swift 6
It’s hard to investigate Swift concurrency problems without knowing more about your build environment, so I tried reproducing this here in my office: Using Xcode 26.5, I created a new project from the iOS > App template. I changed it to use the Swift 6 language mode. I changed ContentView.swift to this: import SwiftUI /* @preconcurrency */ import DeclaredAgeRange struct ContentView: View { @Environment(.requestAgeRange) var requestAgeRange var body: some View { VStack { Button(Test) { Task { do { let response = try await requestAgeRange(ageGates: 13, 15, 18) // ^ // Sending value of non-Sendable type 'DeclaredAgeRangeAction' risks // causing data races // // Sending main actor-isolated value of non-Sendable type // 'DeclaredAgeRangeAction' to @concurrent instance method // 'callAsFunction(ageGates:_:_:)' risks causing races in between // main actor-isolated and @concurrent uses print(response) } catch { } } } } .padding() } } #Preview { ContentView() } I think this accurately reflects the error yo
Replies
Boosts
Views
Activity
Jun ’26
Individual enrolment stuck at "ID Verification Rejected" — no detail surfaced, support silent past SLA
Hi all, Hoping someone has hit and resolved this exact pattern, or can point me to the right escalation path. I'm trying to enrol in the Apple Developer Program as an Individual (Bengaluru, India). The Apple Developer iOS app shows ID Verification Rejected under the Apple Developer Program status — but with no specific reason and no retry button. The app does not surface what was actually wrong with the verification. What I have already done: Confirmed my Apple Account name (Adarsh P S) exactly matches my Passport and PAN card (no extra spaces, correct initials). Opened Developer Support case #102900128848 — the agent replied once on 2026-05-28 asking for a screenshot, which I provided the same day. No follow-up in 3+ business days. Filed a parallel case #102905434551 on 2026-06-02 explicitly referencing the first as escalation, not a duplicate. Apple ID has 2FA enabled, trusted device active, billing address on file. Questions for anyone who has gotten past this: Did the verification reset come from support,
Replies
12
Boosts
0
Views
1.7k
Activity
Jun ’26
(Air)Printing from JavaScript in Safari?
Is there any documentation or advice on printing from a Safari webapp (in JavaScript)? My app needs to print labels, and printing from Safari presents few options. For example, you can't turn off backgrounds or the URL/date/time footer. And it wants to print a full-size page, which ends up printing miles of label. (I've also tried printing from SwiftUI on a macOS app, and even that is just terrible to try to get right. Why is printing so hard?)
Replies
0
Boosts
0
Views
898
Activity
May ’26
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
Replies
0
Boosts
0
Views
349
Activity
May ’26
Reply to Gesture causing AGGraphGetValue
Hi @rahmcoff, This is not a bug in the convert call itself — it's a re-entrancy / lifetime problem with the Context's coordinate-space converter. The crash happens because context.converter.convert(globalPoint:to:) ends up reading a SwiftUI GeometryProxy/UnaryLayoutComputer value out of the AttributeGraph, and the attribute it tries to read is being evaluated at a moment when its dependencies are not in a valid, resolved state. One thing to keep in mind is that AG::precondition_failure → abort() is AttributeGraph's way of saying you asked the graph for a value while the graph was mid-update or the node has been invalidated. The reason this abort() is intermittent (~1 in 1000) is that it only triggers when the gesture action fires while a layout pass affecting that representable is in flight, or after the view providing that coordinate space has been removed/recycled. I'd suggest you consider one of the following options: The code captures coordinateSpace (or the converter) and are using it at the wro
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
May ’26
Reply to How to trigger hover events in UI in RealityView 3D space
Hi @MaoChao The closure passed to hoverEffect is a builder, not an event handler. SwiftUI calls it to construct the visual effect for each phase. You should return a modified effect based on isActive, not run side effects like print inside it. Note: visionOS does not deliver gaze-hover events to your app. Eye input is private, so there is no callback that fires when people look at your view. Fix: usehoverEffect only for visuals, and a Button action (or onTapGesture) for logic: Button(Hover to scale) { } .hoverEffect { effect, isActive, _ in effect.scaleEffect(isActive ? 1.1 : 1.0) }
Replies
Boosts
Views
Activity
May ’26
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: UIViewControllerRepresentable where Content: View { @ViewBuilder var content: (UIViewController) -> Content func makeUIViewController(context: Context) -> UIHostingController { UIHostingController(rootView: content(UIViewController())) } func updateUIViewController(_ uiViewController: UIHostingController, context: Context) { uiViewController.rootView = content(uiViewController) uiViewController.view.isUserInteractionEnabled
Replies
0
Boosts
0
Views
183
Activity
May ’26
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) 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 h
Replies
0
Boosts
0
Views
331
Activity
May ’26
SwiftData crash on new property (Could not cast...)
I have a small example where adding a new property to a persisted Codable struct causes a crash on launch instead of decoding the missing property using its default value. Steps Run this app once and press Insert Event to persist data: import SwiftUI import SwiftData @main struct SwiftDataCrash: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: Event.self) } } struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var events: [Event] var body: some View { VStack(spacing: 12) { Text(Events: (events.count)) Button(Insert Event) { let event = Event( recurrence: Recurrence( interval: 1 ) ) modelContext.insert(event) try? modelContext.save() } List(events) { event in Text(String(describing: event.recurrence)) } } .padding() } } @Model final class Event { var recurrence: Recurrence? = nil init(recurrence: Recurrence? = nil) { self.recurrence = recurrence } } struct Recurrence: Codable { var interval: Int // STEP 2: // After first run + i
Replies
2
Boosts
0
Views
886
Activity
May ’26
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
Replies
1
Boosts
0
Views
291
Activity
May ’26
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)
Replies
1
Boosts
0
Views
189
Activity
May ’26
Unintended X-axis layout shift of a Button when sibling views animate and keyboard appears
Hello everyone, My name is Keita Tomizu. I'm a university student in Japan, currently developing a personal app. I am facing a tricky SwiftUI layout issue that I have spent hours trying to solve, and I would really appreciate your insights. Context & Goal: I have an overlay UI layer (zIndex(4)) consisting of a VStack that contains top and bottom HStacks. • In the top-left, there is a back button (<). • In the top-right and bottom-right, there are action buttons. • When a user taps the bottom-right button, a state isShowingAddView becomes true. This brings up a keyboard and a custom view in the background. • My Goal: When isShowingAddView is true, the right-side buttons should scale up and fade out (opacity to 0) in place. The top-left < button should remain completely static and anchored in its exact position. The Issue: When the state toggles, the < button unexpectedly shifts horizontally (along the X-axis) and sometimes behaves erratically, moving off-screen or losing its static positi
Topic: Design SubTopic: General
Replies
0
Boosts
0
Views
1.4k
Activity
May ’26