Search results for

swiftui

16,588 results found

Post

Replies

Boosts

Views

Activity

Reply to UIRequiresFullScreen Deprecation
So basically the fix is to: Make your app to support all orientations and support resizing. Easy ! All disable all orientations on iPad and stick to one orientation. The funny thing is that my app is already supporting all orientations and I'm using native SwiftUI but the problem is that the window controls are overlapping navigation of my app, which is using standard top-left navigation to go back. So my app is not usable on windowed mode. I've put a lot of effort on the landscape mode and I will need to disable it. Thank you.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’25
ARView ignores multi-touch events
Hi, How to enable multitouch on ARView? Touch functions (touchesBegan, touchesMoved, ...) seem to only handle one touch at a time. In order to handle multiple touches at a time with ARView, I have to either: Use SwiftUI .simultaneousGesture on top of an ARView representable Position a UIView on top of ARView to capture touches and do hit testing by passing a reference to ARView Expected behavior: ARView should capture all touches via touchesBegan/Moved/Ended/Cancelled. Here is what I tried, on iOS 26.1 and macOS 26.1: ARView Multitouch The setup below is a minimal ARView presented by SwiftUI, with touch events handled inside ARView. Multitouch doesn't work with this setup. Note that multitouch wouldn't work either if the ARView is presented with a UIViewController instead of SwiftUI. import RealityKit import SwiftUI struct ARViewMultiTouchView: View { var body: some View { ZStack { ARViewMultiTouchRepresentable() .ignoresSafeArea() } } } #Preview { ARViewMultiTouchView() }
1
0
299
Nov ’25
Reply to Scrolling through long lists with ScrollView and LazyVstack
They could be various things going on here depending on your implementation. So the first thing here is to profile your view to identify what coudl be causing the performance issues. Please review Optimize SwiftUI performance with Instruments. Another thing to consider is if you want to load all your data into memory including comments or fetch those as needed. That said, stack views load their child views all at once which makes layout fast and reliable, because the system knows the size and shape of every subview as it loads them while Lazy stacks trade some degree of layout correctness for performance, because the system only calculates the geometry for subviews as they become visible.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
Reply to EXC_BAD_ACCESS (code=EXC_I386_GPFLT) when using RegisterEventHotKey + SwiftUI AppDelegate
Any advice on a modern alternative (e.g., using NSEvent.addGlobalMonitorForEvents or another framework) that can replace this global hotkey mechanism would also be appreciated. In a SwiftUI View, to observe and react to keyboard input in a focused view hierarchy you can use the onKeyPress(_:action:) modifier. The would allow you specify key event matching conditions and provides an action to fire when a match is found. If you're using AppKits NSEvent.addGlobalMonitorForEvents you could use an observable object and SwiftUI would know when theirs an event change. For example: @Observable class Manager { var eventModifiers = EventModifiers() var localEventMonitor: Any? var globalEventMonitor: Any? init() { localEventMonitor = NSEvent.addLocalMonitorForEvents( matching: [.flagsChanged], handler: { [weak self] event in self?.eventModifiers = self?.convertModifierFlags(event.modifierFlags) ?? EventModifiers() return event } ) globalEventMonitor = NSEvent.addGlobalMonitorForEvents( matching: [.flag
Topic: UI Frameworks SubTopic: SwiftUI
Nov ’25
EXC_BAD_ACCESS (code=EXC_I386_GPFLT) when using RegisterEventHotKey + SwiftUI AppDelegate
Hi everyone, I’m working on a macOS SwiftUI app that integrates a global keyboard shortcut using the old Carbon API (RegisterEventHotKey, InstallEventHandler, etc.). Everything works fine initially, but I’m running into a consistent EXC_BAD_ACCESS (code=EXC_I386_GPFLT) crash when the app is reopened, or sometimes even while drawing on my SwiftUI canvas view. Setup Here’s the relevant setup (simplified): private let hotKeySignature: FourCharCode = 0x626c6e6b // 'blnk' private weak var hotKeyDelegate: AppDelegate? private func overlayHotKeyHandler( _ callRef: EventHandlerCallRef?, _ event: EventRef?, _ userData: UnsafeMutableRawPointer? ) -> OSStatus { guard let appDelegate = hotKeyDelegate else { return noErr } return appDelegate.handleHotKey(event: event) } final class AppDelegate: NSObject, NSApplicationDelegate { private var hotKeyRef: EventHotKeyRef? private var eventHandlerRef: EventHandlerRef? override init() { super.init() hotKeyDelegate = self } func applicationDidFinishLaunching(_
Topic: UI Frameworks SubTopic: SwiftUI
1
0
60
Nov ’25
Duplicate toolbar item and wrong document name in SwiftUI document based app
My app is a SwiftUI document based app using DocumentGroupLaunchScene. In iOS(iPadOS) 18.4, when it launches, it has duplicate toolbar items, and when I close the current document and open other documents, it adds more duplicates. It also shows a wrong document name, which shows the first opened document name. This issue can be reproduced in the sample code (Building a document-based app with SwiftUI). I have submitted Feedback (FB17025216), but not sure if this is a known bug or if I'm missing anything.
8
0
443
Nov ’25
iOS 26 regression: Slider does not respect step parameter
In iOS 26, the Slider control no longer respects the step parameter. For example, import SwiftUI struct ContentView: View { @State private var sliderValue: CGFloat = 16 var body: some View { Slider( value: $sliderValue, in: 0...100, step: 5, onEditingChanged: { editing in print(sliderValue) } ) } } In iOS 18, this prints values like 5, 35, 60, 95, etc. In iOS 26.0 (release version), this prints floats that are not rounded to the nearest 5, and the slider does not snap to values ending in 5. Feedback report number: FB20320542
Topic: UI Frameworks SubTopic: SwiftUI
6
0
316
Nov ’25
Reply to SwiftUI Instrumentation Fails to start
Some questions. By SwiftUI instrumentation, do you mean profile your app in Instruments with the SwiftUI instrument? What version of Xcode are you running? What version of iOS is the device running? The new SwiftUI instrument Apple added in Xcode 26 requires iOS 26+. If your device is running an earlier version of iOS, you can't use the new SwiftUI instrument. If you can't use the new SwiftUI instrument in Xcode 26, click the Add Instrument button above the timeline pane graphs and add the legacy View Body and View Properties instruments to profile the app. Also, remove the SwiftUI instrument from the trace.
Nov ’25
Picking image in iOS-first app when running it on macOS 26
An app that is capable of running on iPad can be usually run on Mac if properly designed and that's great. Recently I've tried to launch one of my old apps on macOS 26 in Designed for iPad mode and noticed that image picker behaves oddly. Images are barely selectable, you have to click several times and yet it might select image and might not. On iPhone and on iPad any kind of image picking works fine. I've tried all kinds of native pickers (PhotosPicker, PHPickerViewController, UIImagePickerController), but the result is almost the same. So how should I nowadays do image picking in (mostly) iOS app when it is run on macOS? Below is the most canonical and modern code I've tried. The issue is reproduced even with such bare minimum of code with the label not being put to a Form/List or any other factors. import SwiftUI import PhotosUI struct ContentView: View { @State private var selectedItem: PhotosPickerItem? @State private var selectedImage: UIImage? var body: some View { VStack { if let selectedIma
Topic: UI Frameworks SubTopic: SwiftUI Tags:
3
0
75
Nov ’25
NSOutlineView incorrectly draws disclosure indicator when item views are SwiftUI views.
I am using an NSOutlineView via NSViewRepresentable in a SwiftUI application running on macOS. Everything has been working fine. Up until lately, I've been returning a custom NSView for each item using the standard: func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? { // View recycling omitted. return MyItemView(item) } Now I want to explore using a little bit more SwiftUI and returning an NSHostingView from this delegate method. func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? { // View recycling omitted. let rootView = MySwiftUIView(item) let hostingView = NSHostingView(rootView: rootView) return hostingView } For the most part, this appears to be working fine. NSOutlineView is even correctly applying highlight styling, so that's great. But there's one small glitch. The outline view's disclosure triangles do not align with the hosting view's content. The disclosure triangle
1
0
137
Nov ’25
AVSpeechSynthesizer pulls words out of thin air.
Hi, I'm working on a project that uses the AVSpeechSynthesizer and AVSpeechUtterance. I discovered by chance that the AVSpeechSynthesizer automatically completes some words instead of just outputting what it's supposed to. These are abbreviations for days of the week or months, but not all of them. I don't want either of them automatically completed, but only the specified text. The completion transcends languages. I have written a short example program for demonstration purposes. import SwiftUI import AVFoundation import Foundation let synthesizer: AVSpeechSynthesizer = AVSpeechSynthesizer() struct ContentView: View { var body: some View { VStack { Button { utter(mon) } label: { Text(mon) } .buttonStyle(.borderedProminent) Button { utter(tue) } label: { Text(tue) } .buttonStyle(.borderedProminent) Button { utter(thu) } label: { Text(thu) } .buttonStyle(.borderedProminent) Button { utter(feb) } label: { Text(feb) } .buttonStyle(.borderedProminent) Button { utter(feb, lang: de-DE) } label: { Text(feb
1
0
206
Nov ’25
List Section with Swipe Action - glitches
Overview I have an iOS project where I have a list with sections. Each cell in the section can be swiped to have some action What needs to be done When swipe button is pressed the cell needs to move from one section to the other without a UI glitch. Problem When I press the swipe action button, there is a UI glitch and some warnings are thrown. UICollectionView internal inconsistency: unexpected removal of the current swipe occurrence's mask view. Please file a bug against UICollectionView. Reusable view: >; Collection view: ; backgroundColor = ; layer = ; contentOffset: {0, -62}; contentSize: {402, 229}; adjustedContentInset: {62, 0, 34, 0}; layout: ; dataSource: <_TtGC7SwiftUI31UICollectionViewListCoordinatorGVS_28CollectionViewListDataSourceOs5Never_GOS_19SelectionManagerBoxS2___: 0x106822a00>>; Swipe occurrence: {length = 2, path = 0 - 0}, state: .triggered, direction: left, offset: 0> Test environment: Xcode 26.0.1 (17A400) iOS 26 Simulator (iPhone 17 Pro) Feedback filed: FB20890361 Code
Topic: UI Frameworks SubTopic: SwiftUI
4
0
225
Nov ’25