Search results for

“swiftui”

17,491 results found

Post

Replies

Boosts

Views

Activity

Reply to How to get Ask Siri context menu button
Hello @Jordan, From WWDC26 session: Modernize your UIKit app Menus will automatically display this item when there's content relevant for Siri. To provide more relevant information specific to your app, use the new View Annotations API. With it you can annotate specific views with AppEntities. For SwiftUI: Use .appEntityIdentifier() on something like each cell inside of a ForEach: ForEach(items) { item in CellView(item: item) .appEntityIdentifier( EntityIdentifier(for: MyItemEntity.self, identifier: item.id) ) .contextMenu { ... } } This is the View Entity Annotation API from session 343: Explore advanced App Intents features for Siri and Apple Intelligence Note: MyItemEntity must conform to AppEntity with a persistent identifier. For more information see: App Intents I hope this helps!  Travis
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’26
Reply to Interface Builder is barely usable
IB is such a perfect tool to visually build a layout, I am very sad to see it so neglected. Fully agree. Doing in code makes is so hard to understand and quasi impossible to maintain. And I don't find SwiftUI so good to design precise UI (where many items need to be precisely positioned). I compared Xcode 26.3 and 16.4 : 26.3 takes between 9 and 12s to open the first view in IB, instead of 6s. Would be really interesting to know what it does differently.
Jun ’26
Reply to Interface Builder is barely usable
Not an option for me, I find code-based auto-layout in UIKit barely readable after say 3-4 components. And I have quite a lot of storyboards with 50+ views and components. None of those were any particular issue to maintain before Xcode 16. Since then, it does not matter if I open UICVCell .xib with 3-4 labels and image views or a storyboard with 50 items - initial opening of the file just takes a while. IB is such a perfect tool to visually build a layout, I am very sad to see it so neglected. Sidenote: few major apps I do are still iOS 15+ so SwiftUI is not an option; iOS 18+ is first version of that framework I would consider somewhat feature-complete and usable.
Jun ’26
Various menu bar NSStatusItem issues with macOS 27
It seems like macOS 27 beta 2 has some issues with NSStatusItem buttons added to the menu bar - this creates difficulties for some menu bar extra apps. NSStatusItem buttons does not receive mouse hover/movement events - FB23329983 On macOS 27, views inside an NSStatusItem button no longer receive hover or mouse-movement events. The same code works correctly on macOS 26. What I tried: An NSTrackingArea attached to a subview of NSStatusBarButton An NSTrackingArea attached directly to the status-bar button Replacing NSStatusItem.view with a custom view Embedding an NSHostingView and using SwiftUI onHover/onContinuousHover NSStatusItem button highlight cannot be set programmatically. - FB23330269 The following code no longer has any effect (does not provide the highlight capsule): NSStatusItem.button?.highlight(true) NSStatusItem window occlusionState no longer reflects hidden menu bar visibility - FB23349447 The following no longer works: statusItem.button?.window?.occlusionState.contains(.visible) Thes
6
0
775
Jun ’26
Action of full-width button in ToolbarItem is not triggered
To make a toolbar button that has the maximum width, I proceed as shown below with iOS 26. The appearance of the button is as expected, but its behavior is incorrect. The action is not triggered when tapping within the button, but outside its text. How to make the action triggered when tapping anywhere within the button ? import SwiftUI struct SampleView: View { var body: some View { NavigationStack { Text() .toolbar { ToolbarItem(placement: .bottomBar) { Button(role: .confirm, action: self.action) { Text(Action) } .frame(maxWidth: .infinity) } } } } private func action() { print(Action Triggered !) } } #Preview { SampleView() }
3
0
545
Jun ’26
How to get Ask Siri context menu button
In my UIKit apps, collection view cells that have a context menu gain an Ask Siri item in iOS 27 without me doing anything. In my SwiftUI app I have a LazyVGrid containing a ForEach of CellView which is a Button that has a contextMenu, yet there’s no Ask Siri button in the context menu. What determines whether or not it will be added? What do I need to do to allow the system to add it?
2
0
401
Jun ’26
Indentation in SwiftUI?
I need to display verse so that if a line exceeds the right margin, it is continued on the next line but indented. In UIKit this is easy by using NSParagraphStyle and headIndent and firstLineHeadIndent. But none of this is available on SwiftUI on the Apple Watch, which marks a big step back compared to WatchKit. Is there any way to display text indented in this way? I attach two screenshots, one with the indentation and one without. The one with indentation is far more readable!
Topic: UI Frameworks SubTopic: SwiftUI
4
0
308
Jun ’26
macOS 27 beta: LocalAuthenticationView causes LAContext policy evaluation to fail with LAErrorDomain -1007
I’m seeing a regression in macOS 27 beta when using SwiftUI LocalAuthenticationView. When an LAContext is attached to LocalAuthenticationView, subsequent policy evaluation fails immediately with: Error Domain=com.apple.LocalAuthentication Code=-1007 NSDebugDescription=Caller is not Apple signed. NSLocalizedDescription=Authentication denied. The same policies work when evaluated on a plain LAContext that has not been attached to LocalAuthenticationView. Minimal shape of the failing path: @State private var context = LAContext() LocalAuthenticationView(context: context) { EmptyView() } context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: Unlock) { success, error in print(success, error as Any) } This affects Touch ID unlock in our macOS app. We currently work around it by detecting LAErrorDomain / -1007, removing LocalAuthenticationView, and asking the user to manually start Touch ID with a fresh LAContext. Filed as Feedback: FB23262713 Could someone from the beta / LocalAu
3
0
760
Jun ’26
How do you get continuous eye-gaze coordinates on visionOS? (accessibility AAC app — all hover APIs return zero events)
Building Dasher (eye-gaze text-entry system for people with motor impairments — ALS, cerebral palsy, etc.) for visionOS. See https://github.com/dasher-project/Dasher-Apple The app needs continuous (x, y) gaze coordinates to steer a zooming alphabet interface. Vision Pro has incredible eye tracking hardware built in — this should be the perfect platform — but I can't get gaze coordinates through any API I've tried. What I've tested (all deliver zero events in a windowed app): UIHoverGestureRecognizer — Apple's docs say it detects when the user is looking at a view on visionOS. Added it to a UIView inside UIViewRepresentable. Looked at the view for 2+ minutes on real hardware. Console.app shows zero began/changed/ended callbacks. .onContinuousHover (SwiftUI) — zero .active phases delivered, whether attached to the canvas view or the ZStack root. UIPointerInteraction with a delegate — regionFor callback never fires. The system clearly is tracking gaze — I can see beginScrollingWithRegion events in Conso
2
0
433
Jun ’26
SwiftUI DragGesture is permanently cancelled (no terminal onEnded) by a trackpad magnify on macOS
Filed as FB23362414, with a minimal sample: https://github.com/mesqueeb/Swiftui-Gesture-Detection-Failures While a SwiftUI DragGesture is held (trackpad click-drag), a two-finger magnify (trackpad pinch) permanently cancels it: onChanged stops firing the instant the magnify is recognized. onEnded is never delivered — the gesture is torn down with no terminal event. Continued motion of the same, still-pressed finger after the pinch is not re-detected. The drag only recovers after a full release and re-press. Throughout, the AppKit NSEvent stream keeps delivering .leftMouseDragged (and a clean .leftMouseUp on release), so the OS is still tracking the drag — it's SwiftUI's gesture arbitration that discards it. No gesture composition avoids this: .simultaneousGesture, .highPriorityGesture, varying gesture order, and .exclusively(before:) in both directions were all tried; none delivers a terminal onEnded or resumes the drag after the pinch. Steps to reproduce (full sample in the repo —
0
0
269
Jun ’26
Reply to Application Hangs with Nested LazyVStack When Accessibility Inspector is Active
Do you have an updated project to share that reproduces the crash? When I run your submitted project on the latest iOS 27 beta, the app runs as it did before. I haven't been able to replicate a crash if that helps. Note, the race condition is still present in this project and it would be best to isolate issue before evaluating performance. Recently, an entire session on lazy containers was shared at WWDC26. See Dive into lazy stacks and scrolling with SwiftUI, the goal of this session was a deep dive into lazy stacks as well as clarify best practices. Feel free to share an update on your project here and let me know what steps you do to reproduce a crash. Also, updates on feedback reports are provided through Feedback Assistant – so feel free to keep checking there and use this post to update us on what you find.  Travis
Jun ’26
Adaptive Layouts iOS 27
I was experimenting with existing APIs using a NavigationSplitView and noticed that in the SwiftUI preview, resizing causes the component to switch between the content view and the sidebar. However, with the new DeviceHub tool, the app doesn’t detect the new size and stays in the content view. Is this expected? I would expect Navigation Split View to handle size changes automatically. Is this expected behaviour? FB23340323
3
0
411
Jun ’26
SwiftUI Equivalent of Nested Scroll Connection for Collapsing Profile Screens
I'm trying to build a profile-style screen similar to X (Twitter), Instagram, or YouTube. The layout is roughly: ┌──────────────────────────┐ │ Profile Header │ │ Cover image │ │ Avatar │ │ Bio / Stats │ └──────────────────────────┘ ┌──────────────────────────┐ │ Tab Bar │ │ Posts | Media | Likes │ └──────────────────────────┘ ┌──────────────────────────┐ │ Tab Content │ │ │ │ ScrollView / List │ │ OR │ │ Empty State VStack │ │ │ └──────────────────────────┘ Requirements: The profile header should collapse while scrolling up. The tab bar should remain pinned. Once the header is fully collapsed, the active tab's scroll view should start scrolling. While scrolling down, the active tab should scroll back to the top first, then the header should expand. Some tabs may contain: ScrollView + LazyVStack List a non-scrollable VStack (for empty states) The behavior should remain consistent regardless of which tab is active. This feels very similar to Jetpack Compose's NestedScrollConnection, where parent and child scro
0
0
269
Jun ’26
Live Activity reports .active via ActivityKit but widget extension never renders or appears in process list (works fine in isolated test project)
I'm seeing a Live Activity that successfully starts via Activity.request() — activityState returns .active, a valid ActivityKit push token is issued and works correctly — but nothing ever appears on the Lock Screen, and the widget extension process never shows up in Xcode's Debug → Attach to Process list (the main app process does appear). This happens consistently across many clean rebuilds. Setup: Flutter app (using the live_activities Flutter plugin, which wraps ActivityKit) with a native iOS Widget Extension target for the Live Activity Xcode 26.5, iOS 18.7.9 on a physical iPhone XS Max Bundle ID: com.santitech.foodboda, extension: com.santitech.foodboda.FoodbodaLiveActivity NSSupportsLiveActivities = YES confirmed in both the main app's Info.plist and the extension's Info.plist (verified in the compiled .appex binary itself, not just source) App Group entitlement confirmed present in both compiled provisioning profiles via security cms -D on embedded.mobileprovision Deployment target 16.6 on both targets
0
0
698
Jun ’26
Reply to OS27 LazyVGrid hops like crazy on scroll up.
@DTS Engineer This sample project shows one LazyVGrid in a ScrollView, that looks fine – I'm curious to see if you find yourself needing to nest lazy stacks, there might be other ways to achieve the same result. I tried nesting lazyVgrids cause I wanted to try to have per-section column layouts. It was mess, though, with entire sections disappearing on scroll. Suggestion for perSection columns here: FB23162564 This exact situation is covered in our WWDC26 session I have watched this video. It is hard for me to know what about my views is not stable enough. The cells in my feedback project (FB23182374) are either a VStack or HStack, and that's not changed at run time in the project. It's compiled to always be VStack. Does that matter to the internal mechanisms of LazyVGrid if that VStack never changes? I will experiment with this in my more complex app. Given the VStack never changes, the cell body always contains an image display area that has an .aspectRatio modifier on it (giving it a stable height for a gi
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’26
Reply to How to get Ask Siri context menu button
Hello @Jordan, From WWDC26 session: Modernize your UIKit app Menus will automatically display this item when there's content relevant for Siri. To provide more relevant information specific to your app, use the new View Annotations API. With it you can annotate specific views with AppEntities. For SwiftUI: Use .appEntityIdentifier() on something like each cell inside of a ForEach: ForEach(items) { item in CellView(item: item) .appEntityIdentifier( EntityIdentifier(for: MyItemEntity.self, identifier: item.id) ) .contextMenu { ... } } This is the View Entity Annotation API from session 343: Explore advanced App Intents features for Siri and Apple Intelligence Note: MyItemEntity must conform to AppEntity with a persistent identifier. For more information see: App Intents I hope this helps!  Travis
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’26
Reply to Interface Builder is barely usable
IB is such a perfect tool to visually build a layout, I am very sad to see it so neglected. Fully agree. Doing in code makes is so hard to understand and quasi impossible to maintain. And I don't find SwiftUI so good to design precise UI (where many items need to be precisely positioned). I compared Xcode 26.3 and 16.4 : 26.3 takes between 9 and 12s to open the first view in IB, instead of 6s. Would be really interesting to know what it does differently.
Replies
Boosts
Views
Activity
Jun ’26
Reply to Interface Builder is barely usable
Not an option for me, I find code-based auto-layout in UIKit barely readable after say 3-4 components. And I have quite a lot of storyboards with 50+ views and components. None of those were any particular issue to maintain before Xcode 16. Since then, it does not matter if I open UICVCell .xib with 3-4 labels and image views or a storyboard with 50 items - initial opening of the file just takes a while. IB is such a perfect tool to visually build a layout, I am very sad to see it so neglected. Sidenote: few major apps I do are still iOS 15+ so SwiftUI is not an option; iOS 18+ is first version of that framework I would consider somewhat feature-complete and usable.
Replies
Boosts
Views
Activity
Jun ’26
Various menu bar NSStatusItem issues with macOS 27
It seems like macOS 27 beta 2 has some issues with NSStatusItem buttons added to the menu bar - this creates difficulties for some menu bar extra apps. NSStatusItem buttons does not receive mouse hover/movement events - FB23329983 On macOS 27, views inside an NSStatusItem button no longer receive hover or mouse-movement events. The same code works correctly on macOS 26. What I tried: An NSTrackingArea attached to a subview of NSStatusBarButton An NSTrackingArea attached directly to the status-bar button Replacing NSStatusItem.view with a custom view Embedding an NSHostingView and using SwiftUI onHover/onContinuousHover NSStatusItem button highlight cannot be set programmatically. - FB23330269 The following code no longer has any effect (does not provide the highlight capsule): NSStatusItem.button?.highlight(true) NSStatusItem window occlusionState no longer reflects hidden menu bar visibility - FB23349447 The following no longer works: statusItem.button?.window?.occlusionState.contains(.visible) Thes
Replies
6
Boosts
0
Views
775
Activity
Jun ’26
Action of full-width button in ToolbarItem is not triggered
To make a toolbar button that has the maximum width, I proceed as shown below with iOS 26. The appearance of the button is as expected, but its behavior is incorrect. The action is not triggered when tapping within the button, but outside its text. How to make the action triggered when tapping anywhere within the button ? import SwiftUI struct SampleView: View { var body: some View { NavigationStack { Text() .toolbar { ToolbarItem(placement: .bottomBar) { Button(role: .confirm, action: self.action) { Text(Action) } .frame(maxWidth: .infinity) } } } } private func action() { print(Action Triggered !) } } #Preview { SampleView() }
Replies
3
Boosts
0
Views
545
Activity
Jun ’26
How to get Ask Siri context menu button
In my UIKit apps, collection view cells that have a context menu gain an Ask Siri item in iOS 27 without me doing anything. In my SwiftUI app I have a LazyVGrid containing a ForEach of CellView which is a Button that has a contextMenu, yet there’s no Ask Siri button in the context menu. What determines whether or not it will be added? What do I need to do to allow the system to add it?
Replies
2
Boosts
0
Views
401
Activity
Jun ’26
Indentation in SwiftUI?
I need to display verse so that if a line exceeds the right margin, it is continued on the next line but indented. In UIKit this is easy by using NSParagraphStyle and headIndent and firstLineHeadIndent. But none of this is available on SwiftUI on the Apple Watch, which marks a big step back compared to WatchKit. Is there any way to display text indented in this way? I attach two screenshots, one with the indentation and one without. The one with indentation is far more readable!
Topic: UI Frameworks SubTopic: SwiftUI
Replies
4
Boosts
0
Views
308
Activity
Jun ’26
macOS 27 beta: LocalAuthenticationView causes LAContext policy evaluation to fail with LAErrorDomain -1007
I’m seeing a regression in macOS 27 beta when using SwiftUI LocalAuthenticationView. When an LAContext is attached to LocalAuthenticationView, subsequent policy evaluation fails immediately with: Error Domain=com.apple.LocalAuthentication Code=-1007 NSDebugDescription=Caller is not Apple signed. NSLocalizedDescription=Authentication denied. The same policies work when evaluated on a plain LAContext that has not been attached to LocalAuthenticationView. Minimal shape of the failing path: @State private var context = LAContext() LocalAuthenticationView(context: context) { EmptyView() } context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: Unlock) { success, error in print(success, error as Any) } This affects Touch ID unlock in our macOS app. We currently work around it by detecting LAErrorDomain / -1007, removing LocalAuthenticationView, and asking the user to manually start Touch ID with a fresh LAContext. Filed as Feedback: FB23262713 Could someone from the beta / LocalAu
Replies
3
Boosts
0
Views
760
Activity
Jun ’26
How do you get continuous eye-gaze coordinates on visionOS? (accessibility AAC app — all hover APIs return zero events)
Building Dasher (eye-gaze text-entry system for people with motor impairments — ALS, cerebral palsy, etc.) for visionOS. See https://github.com/dasher-project/Dasher-Apple The app needs continuous (x, y) gaze coordinates to steer a zooming alphabet interface. Vision Pro has incredible eye tracking hardware built in — this should be the perfect platform — but I can't get gaze coordinates through any API I've tried. What I've tested (all deliver zero events in a windowed app): UIHoverGestureRecognizer — Apple's docs say it detects when the user is looking at a view on visionOS. Added it to a UIView inside UIViewRepresentable. Looked at the view for 2+ minutes on real hardware. Console.app shows zero began/changed/ended callbacks. .onContinuousHover (SwiftUI) — zero .active phases delivered, whether attached to the canvas view or the ZStack root. UIPointerInteraction with a delegate — regionFor callback never fires. The system clearly is tracking gaze — I can see beginScrollingWithRegion events in Conso
Replies
2
Boosts
0
Views
433
Activity
Jun ’26
SwiftUI DragGesture is permanently cancelled (no terminal onEnded) by a trackpad magnify on macOS
Filed as FB23362414, with a minimal sample: https://github.com/mesqueeb/Swiftui-Gesture-Detection-Failures While a SwiftUI DragGesture is held (trackpad click-drag), a two-finger magnify (trackpad pinch) permanently cancels it: onChanged stops firing the instant the magnify is recognized. onEnded is never delivered — the gesture is torn down with no terminal event. Continued motion of the same, still-pressed finger after the pinch is not re-detected. The drag only recovers after a full release and re-press. Throughout, the AppKit NSEvent stream keeps delivering .leftMouseDragged (and a clean .leftMouseUp on release), so the OS is still tracking the drag — it's SwiftUI's gesture arbitration that discards it. No gesture composition avoids this: .simultaneousGesture, .highPriorityGesture, varying gesture order, and .exclusively(before:) in both directions were all tried; none delivers a terminal onEnded or resumes the drag after the pinch. Steps to reproduce (full sample in the repo —
Replies
0
Boosts
0
Views
269
Activity
Jun ’26
Reply to Application Hangs with Nested LazyVStack When Accessibility Inspector is Active
Do you have an updated project to share that reproduces the crash? When I run your submitted project on the latest iOS 27 beta, the app runs as it did before. I haven't been able to replicate a crash if that helps. Note, the race condition is still present in this project and it would be best to isolate issue before evaluating performance. Recently, an entire session on lazy containers was shared at WWDC26. See Dive into lazy stacks and scrolling with SwiftUI, the goal of this session was a deep dive into lazy stacks as well as clarify best practices. Feel free to share an update on your project here and let me know what steps you do to reproduce a crash. Also, updates on feedback reports are provided through Feedback Assistant – so feel free to keep checking there and use this post to update us on what you find.  Travis
Replies
Boosts
Views
Activity
Jun ’26
Adaptive Layouts iOS 27
I was experimenting with existing APIs using a NavigationSplitView and noticed that in the SwiftUI preview, resizing causes the component to switch between the content view and the sidebar. However, with the new DeviceHub tool, the app doesn’t detect the new size and stays in the content view. Is this expected? I would expect Navigation Split View to handle size changes automatically. Is this expected behaviour? FB23340323
Replies
3
Boosts
0
Views
411
Activity
Jun ’26
SwiftUI Equivalent of Nested Scroll Connection for Collapsing Profile Screens
I'm trying to build a profile-style screen similar to X (Twitter), Instagram, or YouTube. The layout is roughly: ┌──────────────────────────┐ │ Profile Header │ │ Cover image │ │ Avatar │ │ Bio / Stats │ └──────────────────────────┘ ┌──────────────────────────┐ │ Tab Bar │ │ Posts | Media | Likes │ └──────────────────────────┘ ┌──────────────────────────┐ │ Tab Content │ │ │ │ ScrollView / List │ │ OR │ │ Empty State VStack │ │ │ └──────────────────────────┘ Requirements: The profile header should collapse while scrolling up. The tab bar should remain pinned. Once the header is fully collapsed, the active tab's scroll view should start scrolling. While scrolling down, the active tab should scroll back to the top first, then the header should expand. Some tabs may contain: ScrollView + LazyVStack List a non-scrollable VStack (for empty states) The behavior should remain consistent regardless of which tab is active. This feels very similar to Jetpack Compose's NestedScrollConnection, where parent and child scro
Replies
0
Boosts
0
Views
269
Activity
Jun ’26
Live Activity reports .active via ActivityKit but widget extension never renders or appears in process list (works fine in isolated test project)
I'm seeing a Live Activity that successfully starts via Activity.request() — activityState returns .active, a valid ActivityKit push token is issued and works correctly — but nothing ever appears on the Lock Screen, and the widget extension process never shows up in Xcode's Debug → Attach to Process list (the main app process does appear). This happens consistently across many clean rebuilds. Setup: Flutter app (using the live_activities Flutter plugin, which wraps ActivityKit) with a native iOS Widget Extension target for the Live Activity Xcode 26.5, iOS 18.7.9 on a physical iPhone XS Max Bundle ID: com.santitech.foodboda, extension: com.santitech.foodboda.FoodbodaLiveActivity NSSupportsLiveActivities = YES confirmed in both the main app's Info.plist and the extension's Info.plist (verified in the compiled .appex binary itself, not just source) App Group entitlement confirmed present in both compiled provisioning profiles via security cms -D on embedded.mobileprovision Deployment target 16.6 on both targets
Replies
0
Boosts
0
Views
698
Activity
Jun ’26
Reply to OS27 LazyVGrid hops like crazy on scroll up.
@DTS Engineer This sample project shows one LazyVGrid in a ScrollView, that looks fine – I'm curious to see if you find yourself needing to nest lazy stacks, there might be other ways to achieve the same result. I tried nesting lazyVgrids cause I wanted to try to have per-section column layouts. It was mess, though, with entire sections disappearing on scroll. Suggestion for perSection columns here: FB23162564 This exact situation is covered in our WWDC26 session I have watched this video. It is hard for me to know what about my views is not stable enough. The cells in my feedback project (FB23182374) are either a VStack or HStack, and that's not changed at run time in the project. It's compiled to always be VStack. Does that matter to the internal mechanisms of LazyVGrid if that VStack never changes? I will experiment with this in my more complex app. Given the VStack never changes, the cell body always contains an image display area that has an .aspectRatio modifier on it (giving it a stable height for a gi
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’26