Search results for

“swiftui”

17,233 results found

Post

Replies

Boosts

Views

Activity

iPadOS 26 – SwiftUI Menu in ToolbarItem shifts during pointer hover when view is presented as sheet
I am observing inconsistent pointer hover behavior for a SwiftUI Menu placed inside a ToolbarItem on iPadOS 26.2 (real device). Scenario: • Screen A is pushed inside a NavigationStack. • Screen B is presented as a sheet (with its own NavigationStack). • Both screens contain the same toolbar Menu item using an SF Symbol (arrow.up.arrow.down). Observed behavior: In the pushed view, hover is mostly stable. In the sheet-presented view, the SF Symbol visibly shifts/jumps when pointer hover activates. The hover highlight shape differs from the native navigation back button. Label-level hoverEffect modifiers do not stabilize the behavior. Minimal example: import SwiftUI struct ContentView: View { @State private var showSheet = false var body: some View { NavigationStack { VStack { Button(Open Sheet) { showSheet = true } } .navigationTitle(Home) .toolbar { ToolbarItem(placement: .topBarTrailing) { Menu { Button(Option A) { } Button(Option B) { } } label: { Image(systemName: arrow.up.arrow.down) } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
54
Feb ’26
Reply to How to Create a Full-Width Container (Edge-to-Edge Layout) Above a List View
The Apple sample code Landmarks project uses a LazyVStack inside a ScrollView. For a List, which you want, you will need to: Put the ContainerView in the List as the first row. Set the listRowBackground of the ContainerView to EmptyView(). Set the listStyle to plain, for listRowBackground to work. Add .background(alignment: .top) { with the background you want for the ContainerView. Use readFrame() to dynamically adjust the height of the background to match the maxY position of the ContainerView. import SwiftUI struct ListHeaderScene: View { @State var headerRect: CGRect? var headerHeight: CGFloat { headerRect?.maxY ?? 0 } var body: some View { List { ContainerView() .readFrame { headerRect = $0 } .listRowSeparator(.hidden) .listRowBackground(EmptyView()) Section(Section Title) { Text(Row 1) Text(Row 2) } } .listStyle(.plain) .background(alignment: .top) { // You can swap this for an image or whatever. Color.purple .frame(height: headerHeight) .ignoresSafeArea() } } } struct ContainerView: View { var
Topic: UI Frameworks SubTopic: SwiftUI
Feb ’26
.edgesIgnoringSafeArea(.vertical) combined with .tabViewStyle(.page(indexDisplayMode: .never)) causes "Out of Bounds" layout in Xcode 26 / iOS 26 SDK
I am reporting a regression/behavioral change in the SwiftUI layout engine when building with Xcode 26 (iOS 26 SDK). In previous versions (Xcode 15/16 and iOS 17/18 SDKs), a TabView using .tabViewStyle(.page(indexDisplayMode: .never)) correctly respected the coordinate space when combined with .edgesIgnoringSafeArea(.vertical). However, when compiling with the iOS 26 SDK, the internal views of the TabView render out of bounds, pushing content vertically beyond the intended safe area boundaries and causing UI overlapping/clipping - an abnormal behavior. TabView(selection: $selectedIndex) { ForEach(0..
0
0
71
Feb ’26
TabView inside NavigationStack is abnormal when using Xcode 26
TabView inside NavigationStack is abnormal when using Xcode 26. The y deviation is about 14. But it is right when using Xcode 16.4. It is also right without NavigationStack. import SwiftUI struct ContentView: View { private enum Tab: Hashable, CaseIterable { case a case b } @State private var currentTab: Tab = .a @State private var path: NavigationPath = NavigationPath() var body: some View { NavigationStack(path: $path) { TabView(selection: $currentTab) { ForEach(Tab.allCases, id: .self) { tab in switch tab { case .a: Color.blue // .offset(y: -14) case .b: Color.yellow } } } .tabViewStyle(.page(indexDisplayMode: .never)) .ignoresSafeArea(.all) } } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
75
Feb ’26
Q&A Summary for Code-along: Experiment with coding intelligence in Xcode 26
We received many great questions from the community during Code-along: Experiment with coding intelligence in Xcode 26. Here are the highlights from the questions submitted by the audience during the event. What models does coding intelligence features support In Xcode? Xcode integrates directly with ChatGPT and Claude user accounts. You can also configure Xcode to integrate any model provider that supports the Chat Completions API, such as models that you access with an API key. You can also download and run a local model on a Mac with Apple silicon. Setting up coding intelligence provides all of the information you need to get started with Xcode’s direct integration with ChatGPT and Claude, as well as how to set up Xcode to access other providers. Does Coding Intelligence have access to Apple API and developer documentation? How does it stay up to date with the latest SwiftUI API? Coding agents are great because they talk to a model, generate code and fix errors, but they also have access to tools,
0
0
3.3k
Feb ’26
Reply to Can TextField handle undo?
I investigated further and found your answer! UndoManager is the API in the Foundation framework for undo/redo and SwiftUI has an environment value for that undoManager. This example disables undo on TextField on Mac struct ContentView: View { @Environment(.undoManager) var undoManager: UndoManager? var body: some View { VStack { TextField(Test, text: $text) } .task { undoManager?.disableUndoRegistration() } } } Let me know if this answers your question  Travis Trotto - DTS Engineer
Topic: UI Frameworks SubTopic: SwiftUI
Feb ’26
Reply to Can TextField handle undo?
Sorry for not replying earlier. No, I'm afraid that info isn't what I'm looking for. The thing that I'd like to understand really is, specifically: how to use the built-in undo support of SwiftUI TextField views, if any. Hopefully you're able to get details on this somehow!
Topic: UI Frameworks SubTopic: SwiftUI
Feb ’26
Reply to Swipe to go back still broken with Zoom navigation transition.
Also confirmed this is still broken in iOS 26.3 (23D127). My feedback is FB21078443 filed Nov 2025. If anyone can’t repro it, here’s a minimal example. Tap a color, then swipe back from the left edge—the source view will disappear after the transition. Easier to repro on physical device, but also possible in sim with a solid swipe. import SwiftUI struct ContentView: View { @Namespace private var namespace private let colors: [Color] = [.red, .blue] var body: some View { NavigationStack { VStack(spacing: 16) { ForEach(colors.indices, id: .self) { index in NavigationLink(value: index) { RoundedRectangle(cornerRadius: 16) .fill(colors[index]) .frame(maxWidth: .infinity, minHeight: 200, maxHeight: 200) .matchedTransitionSource(id: index, in: namespace) } .buttonStyle(.plain) } } .padding(20) .navigationTitle(Zoom Transition Issue) .navigationSubtitle(Tap card, then swipe back from left edge) .navigationDestination(for: Int.self) { index in Rectangle() .fill(colors[index]) .ignoresSafeArea() .navigationTr
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’26
ControlWidgetToggle image design
I need help designing the image of a ControlWidgetToggle. do I understand correctly that I can only use an SFSymbol as image and not my custom image (unless setup via a custom SFSymbol)? is there any way I can influence the size of the image? I tried multiple SwiftUI modifiers (.imageScale, .font, .resizable, .controlSize) none of them seem to work. My image remains too tiny the image size of the on and off state is different. Seems to be enforced by the system. Is there any way to make both images use the same size? the on-state tints the image. Is there a way to set the tint color? .tint and .foregroundstyle seem to be ignored. Thank you for your help
1
0
125
Feb ’26
macOS: Is ARKit-equivalent face tracking possible with an external camera?
Hello, I am an individual developer working on a macOS application using SwiftUI and RealityKit. I would like to understand the feasibility of face-related tracking on macOS when using an external USB camera, compared to iOS/iPadOS. Specifically: • Does macOS provide an ARKit Face Tracking–equivalent API (e.g., real-time facial expressions, gaze direction, depth)? • If not, is it common to rely on Vision / AVFoundation as alternatives for: • Facial expression coefficients • Gaze estimation • Depth approximation • In an environment without dedicated sensors such as TrueDepth, is it correct to assume that accurate depth data and high-fidelity blend shape extraction are realistically difficult? Any clarification on official limitations, recommended alternatives, or relevant documentation would be greatly appreciated. Thank you.
0
0
230
Feb ’26
Basics - Dice Demo, calculate total score
I've worked through Apple's dice demo for SwiftUI, so far so good. I've got a single Die view with a button to roll the die. This works perfectly using the code below: struct DieView: View { init(dieType: DieType) { self.dieValue = Int.random(in: 1...dieType.rawValue) self.dieType = dieType } @State private var dieValue: Int @State private var dieType: DieType var body: some View { VStack { if self.dieType == DieType.D6 { Image(systemName: die.face.(dieValue)) .resizable() .frame(width: 100, height: 100) .padding() } else {//self.dieType == DieType.D12{ Text((self.dieValue)) .font(.largeTitle) } Button(Roll){ withAnimation{ dieValue = Int.random(in: 1...dieType.rawValue) } } .buttonStyle(.bordered) } Spacer() } } Now I want to do a DiceSetView with an arbitrary number of dice. I've got the UI working with the following; struct DiceSetView: View { @State private var totalScore: Int = 0 var body: some View { ScrollView(.horizontal) { HStack{ DieView(dieType: DieType.D6) DieView(dieType: DieType.D6) Die
Topic: UI Frameworks SubTopic: SwiftUI
0
0
43
Feb ’26
Reply to iOS App never gets Bluetooth connection
I am going to suggest that your issue is more structural than a Bluetooth connection problem if even print(App initializing) is not printing. Once you get that working (perhaps start with a clean Hello world! project to make sure your code is running. And then you can add the Bluetooth functionality to it using examples. Unfortunately our sample projects are a bit dated, and outside the watchOS sample Interacting with Bluetooth peripherals during background app refresh, we don't have any SwiftUI examples that demonstrate CoreBluetooth. Currently, the CoreBluetooth framework is not fully compatible with SwiftUI, and requires the use of @UIApplicationDelegateAdaptor var delegate: ApplicationDelegate and handle your CoreBluetooth logic in a UIKit class. In the above example, you will find an iOS target BARBluetooth, which will show how the SwiftUI/UIKit integration is handled. (do not consider the code there as a full example though, as that is a specific app that only accompanies the
Topic: App & System Services SubTopic: Core OS Tags:
Feb ’26
iOS App never gets Bluetooth connection
I am developing an iOS App for a Bluetooth peripheral using SwiftUI with Swift 5 or 6. I have a few past attempts that got so far (connected to a peripheral), and some downloaded examples that connect to peripherals. Lately (last month or so), my current attempt never gets BleManager to start, and every attempt ends at my View that says 'please enable Bluetooth'. The Xcode console is totally blank with no print outputs. Coding Assistant suggested the init() in my @main structure could contain print(App initializing), but even that never prints. Coding Assistant suggests: • Open your project's Info.plist in Xcode. • Make sure UIApplicationSceneManifest is present and configured for SwiftUI, not referencing any storyboard. • Ensure UIMainStoryboardFile is not present (or blank). but there is no info.plist because it is no longer required. Downloaded sample code runs and connects to peripherals, so Bluetooth is working on my iPhone and the Bluetooth device is accessible. My older attempts used
2
0
192
Feb ’26
iPadOS 26 – SwiftUI Menu in ToolbarItem shifts during pointer hover when view is presented as sheet
I am observing inconsistent pointer hover behavior for a SwiftUI Menu placed inside a ToolbarItem on iPadOS 26.2 (real device). Scenario: • Screen A is pushed inside a NavigationStack. • Screen B is presented as a sheet (with its own NavigationStack). • Both screens contain the same toolbar Menu item using an SF Symbol (arrow.up.arrow.down). Observed behavior: In the pushed view, hover is mostly stable. In the sheet-presented view, the SF Symbol visibly shifts/jumps when pointer hover activates. The hover highlight shape differs from the native navigation back button. Label-level hoverEffect modifiers do not stabilize the behavior. Minimal example: import SwiftUI struct ContentView: View { @State private var showSheet = false var body: some View { NavigationStack { VStack { Button(Open Sheet) { showSheet = true } } .navigationTitle(Home) .toolbar { ToolbarItem(placement: .topBarTrailing) { Menu { Button(Option A) { } Button(Option B) { } } label: { Image(systemName: arrow.up.arrow.down) } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
54
Activity
Feb ’26
Reply to How to Create a Full-Width Container (Edge-to-Edge Layout) Above a List View
The Apple sample code Landmarks project uses a LazyVStack inside a ScrollView. For a List, which you want, you will need to: Put the ContainerView in the List as the first row. Set the listRowBackground of the ContainerView to EmptyView(). Set the listStyle to plain, for listRowBackground to work. Add .background(alignment: .top) { with the background you want for the ContainerView. Use readFrame() to dynamically adjust the height of the background to match the maxY position of the ContainerView. import SwiftUI struct ListHeaderScene: View { @State var headerRect: CGRect? var headerHeight: CGFloat { headerRect?.maxY ?? 0 } var body: some View { List { ContainerView() .readFrame { headerRect = $0 } .listRowSeparator(.hidden) .listRowBackground(EmptyView()) Section(Section Title) { Text(Row 1) Text(Row 2) } } .listStyle(.plain) .background(alignment: .top) { // You can swap this for an image or whatever. Color.purple .frame(height: headerHeight) .ignoresSafeArea() } } } struct ContainerView: View { var
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Feb ’26
.edgesIgnoringSafeArea(.vertical) combined with .tabViewStyle(.page(indexDisplayMode: .never)) causes "Out of Bounds" layout in Xcode 26 / iOS 26 SDK
I am reporting a regression/behavioral change in the SwiftUI layout engine when building with Xcode 26 (iOS 26 SDK). In previous versions (Xcode 15/16 and iOS 17/18 SDKs), a TabView using .tabViewStyle(.page(indexDisplayMode: .never)) correctly respected the coordinate space when combined with .edgesIgnoringSafeArea(.vertical). However, when compiling with the iOS 26 SDK, the internal views of the TabView render out of bounds, pushing content vertically beyond the intended safe area boundaries and causing UI overlapping/clipping - an abnormal behavior. TabView(selection: $selectedIndex) { ForEach(0..
Replies
0
Boosts
0
Views
71
Activity
Feb ’26
TabView inside NavigationStack is abnormal when using Xcode 26
TabView inside NavigationStack is abnormal when using Xcode 26. The y deviation is about 14. But it is right when using Xcode 16.4. It is also right without NavigationStack. import SwiftUI struct ContentView: View { private enum Tab: Hashable, CaseIterable { case a case b } @State private var currentTab: Tab = .a @State private var path: NavigationPath = NavigationPath() var body: some View { NavigationStack(path: $path) { TabView(selection: $currentTab) { ForEach(Tab.allCases, id: .self) { tab in switch tab { case .a: Color.blue // .offset(y: -14) case .b: Color.yellow } } } .tabViewStyle(.page(indexDisplayMode: .never)) .ignoresSafeArea(.all) } } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
75
Activity
Feb ’26
Q&A Summary for Code-along: Experiment with coding intelligence in Xcode 26
We received many great questions from the community during Code-along: Experiment with coding intelligence in Xcode 26. Here are the highlights from the questions submitted by the audience during the event. What models does coding intelligence features support In Xcode? Xcode integrates directly with ChatGPT and Claude user accounts. You can also configure Xcode to integrate any model provider that supports the Chat Completions API, such as models that you access with an API key. You can also download and run a local model on a Mac with Apple silicon. Setting up coding intelligence provides all of the information you need to get started with Xcode’s direct integration with ChatGPT and Claude, as well as how to set up Xcode to access other providers. Does Coding Intelligence have access to Apple API and developer documentation? How does it stay up to date with the latest SwiftUI API? Coding agents are great because they talk to a model, generate code and fix errors, but they also have access to tools,
Replies
0
Boosts
0
Views
3.3k
Activity
Feb ’26
Reply to Can TextField handle undo?
I investigated further and found your answer! UndoManager is the API in the Foundation framework for undo/redo and SwiftUI has an environment value for that undoManager. This example disables undo on TextField on Mac struct ContentView: View { @Environment(.undoManager) var undoManager: UndoManager? var body: some View { VStack { TextField(Test, text: $text) } .task { undoManager?.disableUndoRegistration() } } } Let me know if this answers your question  Travis Trotto - DTS Engineer
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Feb ’26
Reply to Can TextField handle undo?
Sorry for not replying earlier. No, I'm afraid that info isn't what I'm looking for. The thing that I'd like to understand really is, specifically: how to use the built-in undo support of SwiftUI TextField views, if any. Hopefully you're able to get details on this somehow!
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Feb ’26
Reply to Swipe to go back still broken with Zoom navigation transition.
Also confirmed this is still broken in iOS 26.3 (23D127). My feedback is FB21078443 filed Nov 2025. If anyone can’t repro it, here’s a minimal example. Tap a color, then swipe back from the left edge—the source view will disappear after the transition. Easier to repro on physical device, but also possible in sim with a solid swipe. import SwiftUI struct ContentView: View { @Namespace private var namespace private let colors: [Color] = [.red, .blue] var body: some View { NavigationStack { VStack(spacing: 16) { ForEach(colors.indices, id: .self) { index in NavigationLink(value: index) { RoundedRectangle(cornerRadius: 16) .fill(colors[index]) .frame(maxWidth: .infinity, minHeight: 200, maxHeight: 200) .matchedTransitionSource(id: index, in: namespace) } .buttonStyle(.plain) } } .padding(20) .navigationTitle(Zoom Transition Issue) .navigationSubtitle(Tap card, then swipe back from left edge) .navigationDestination(for: Int.self) { index in Rectangle() .fill(colors[index]) .ignoresSafeArea() .navigationTr
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’26
ControlWidgetToggle image design
I need help designing the image of a ControlWidgetToggle. do I understand correctly that I can only use an SFSymbol as image and not my custom image (unless setup via a custom SFSymbol)? is there any way I can influence the size of the image? I tried multiple SwiftUI modifiers (.imageScale, .font, .resizable, .controlSize) none of them seem to work. My image remains too tiny the image size of the on and off state is different. Seems to be enforced by the system. Is there any way to make both images use the same size? the on-state tints the image. Is there a way to set the tint color? .tint and .foregroundstyle seem to be ignored. Thank you for your help
Replies
1
Boosts
0
Views
125
Activity
Feb ’26
macOS: Is ARKit-equivalent face tracking possible with an external camera?
Hello, I am an individual developer working on a macOS application using SwiftUI and RealityKit. I would like to understand the feasibility of face-related tracking on macOS when using an external USB camera, compared to iOS/iPadOS. Specifically: • Does macOS provide an ARKit Face Tracking–equivalent API (e.g., real-time facial expressions, gaze direction, depth)? • If not, is it common to rely on Vision / AVFoundation as alternatives for: • Facial expression coefficients • Gaze estimation • Depth approximation • In an environment without dedicated sensors such as TrueDepth, is it correct to assume that accurate depth data and high-fidelity blend shape extraction are realistically difficult? Any clarification on official limitations, recommended alternatives, or relevant documentation would be greatly appreciated. Thank you.
Replies
0
Boosts
0
Views
230
Activity
Feb ’26
Basics - Dice Demo, calculate total score
I've worked through Apple's dice demo for SwiftUI, so far so good. I've got a single Die view with a button to roll the die. This works perfectly using the code below: struct DieView: View { init(dieType: DieType) { self.dieValue = Int.random(in: 1...dieType.rawValue) self.dieType = dieType } @State private var dieValue: Int @State private var dieType: DieType var body: some View { VStack { if self.dieType == DieType.D6 { Image(systemName: die.face.(dieValue)) .resizable() .frame(width: 100, height: 100) .padding() } else {//self.dieType == DieType.D12{ Text((self.dieValue)) .font(.largeTitle) } Button(Roll){ withAnimation{ dieValue = Int.random(in: 1...dieType.rawValue) } } .buttonStyle(.bordered) } Spacer() } } Now I want to do a DiceSetView with an arbitrary number of dice. I've got the UI working with the following; struct DiceSetView: View { @State private var totalScore: Int = 0 var body: some View { ScrollView(.horizontal) { HStack{ DieView(dieType: DieType.D6) DieView(dieType: DieType.D6) Die
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
43
Activity
Feb ’26
Reply to iOS App never gets Bluetooth connection
I am going to suggest that your issue is more structural than a Bluetooth connection problem if even print(App initializing) is not printing. Once you get that working (perhaps start with a clean Hello world! project to make sure your code is running. And then you can add the Bluetooth functionality to it using examples. Unfortunately our sample projects are a bit dated, and outside the watchOS sample Interacting with Bluetooth peripherals during background app refresh, we don't have any SwiftUI examples that demonstrate CoreBluetooth. Currently, the CoreBluetooth framework is not fully compatible with SwiftUI, and requires the use of @UIApplicationDelegateAdaptor var delegate: ApplicationDelegate and handle your CoreBluetooth logic in a UIKit class. In the above example, you will find an iOS target BARBluetooth, which will show how the SwiftUI/UIKit integration is handled. (do not consider the code there as a full example though, as that is a specific app that only accompanies the
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Feb ’26
iOS App never gets Bluetooth connection
I am developing an iOS App for a Bluetooth peripheral using SwiftUI with Swift 5 or 6. I have a few past attempts that got so far (connected to a peripheral), and some downloaded examples that connect to peripherals. Lately (last month or so), my current attempt never gets BleManager to start, and every attempt ends at my View that says 'please enable Bluetooth'. The Xcode console is totally blank with no print outputs. Coding Assistant suggested the init() in my @main structure could contain print(App initializing), but even that never prints. Coding Assistant suggests: • Open your project's Info.plist in Xcode. • Make sure UIApplicationSceneManifest is present and configured for SwiftUI, not referencing any storyboard. • Ensure UIMainStoryboardFile is not present (or blank). but there is no info.plist because it is no longer required. Downloaded sample code runs and connects to peripherals, so Bluetooth is working on my iPhone and the Bluetooth device is accessible. My older attempts used
Replies
2
Boosts
0
Views
192
Activity
Feb ’26