Provide views, controls, and layout structures for declaring your app's user interface using SwiftUI.

SwiftUI Documentation

Posts under SwiftUI subtopic

Post

Replies

Boosts

Views

Activity

How to send a message from menu item in SwiftUI App to ContentView
I'm just not getting it. My app adds a custom Import menu item to the File menu. I want to have it tell the sole ContentView to run the fileImporter. Here's how I have it set up. Changing the showFileImporter variable to supposed to make stuff happen, but it doesn't change. @main struct Blah: App { @State public var contentView = ContentView(); var body:some Scene { WindowGroup { // ContentView() // It started out defining the content like normal, but I saw somewhere that if I declared it as a var up top, then I'd have an actual object that I could tell to do things, like calling the importTerms() method below. self.contentView } .commands { CommandGroup(after:.newItem) { Button("Import…") { contentView.importTerms(); } } } } struct ContentView: View { @State private var showFileImporter = false; var body: some View { VStack { ...stuff... } } .fileImporter(isPresented:$showFileImporter, allowedContentTypes:[.text], allowsMultipleSelection:false) { result in } public func importTerms() { print("\(showFileImporter)"); // ->false showFileImporter = true; print("\(showFileImporter)"); // ->yep, still false } } But it doesn't work. It calls importTerms(), and a breakpoint inside that method does get hit. But it doesn't change the value of showFileImporter and the fileImporter never appears. What kind of weird world has Swift made where setting a variable to true doesn't set it to true and there's no error at build or runtime?
Topic: UI Frameworks SubTopic: SwiftUI
10
1
103
22h
Changing a State var in a Timer block doesn't update the UI
Can anyone explain to me why my UI doesn't update after the timer fires in this code below? Even when the timer fires, the UI doesn't update. thanks, in advance for any guidance Mike struct ContentView: View { @State var referenceDate: Date = Date() init () { setupTimer() } func setupTimer() { let calendar = Calendar.current guard let triggerDate = calendar.nextDate( after: Date(), matching: DateComponents(hour: 14, minute: 46, second: 0), matchingPolicy: .nextTime ) else { return } let timer = Timer(fire: triggerDate, interval: 0.2, repeats: false) { _ in self.referenceDate = Date() print("runLoop!") } RunLoop.main.add(timer, forMode: .common) } var body: some View { VStack { Text("Ref time: \(referenceDate.formatted(date: .abbreviated, time: .standard))") } } }
2
0
52
1d
How to get the correct animation when inserting/removing a row in a SwiftUI List from a swipeAction?
Hello, In my app, I have a List with two sections. The first section contains favourited items. The second section contains all the items. I use a swipeAction to favorite / undo favorite an item. An item can be in the first section and in the second section. But when I use the swipeAction to perform the action, the row animation is conflicting with the List animation for insertion / removal (I think). It’s not synchronised and it leads to an ugly UX. GeometryGroup on the Section does not help. One solution is to delay the action so the swipe has enough time to go back to its original position but it’s hacky and depends too much on manual timing, etc. If I favorite / undo from a tap on the row (no swipe action), the animation is correct (obviously, as the row doesn’t need to animate to its original position). I experimented with a ScrollView + swipeActionsContainer() + swipeActions on iOS 27, and it works very nicely. But this solution only works for iOS 27 and my app targets iOS 18. So I would love to have a native implementation for iOS 18+ if possible. Am I missing something to get the correct animation with a List? You can check the attached code: https://gist.github.com/alpennec/f9de25cda29b515eb45af6b368a89ed8 Video: https://www.dropbox.com/scl/fi/sqitivihm4pbu8htxicap/ListSectionsSwipeActions.mov?rlkey=08wl708g82rmyy6nkf75725bv&st=0qb7rhdd&dl=0 I also filed a feedback with a video: FB23661327 Regards, Axel
1
1
46
1d
Drag and Drop stopped working after upgrading from macOS 15 to 26
When I drag and drop a file with flag "shouldAttemptToOpenInPlace: true", I was able to access the original file name in macOS 15. After upgrading to macOS 26, I can't access the original file name anymore. Instead, I got some useless file name such as ".com.apple.Foundation.NSItemProvider.gKZ91u.tmp". The app no longer works with these tmp filenames because it needs the orignal file name to do the file transfer. (Btw, this is a WinSCP like app on Mac platform) Could you please check and fix this issue? Thank you. FileRepresentation(contentType: .item, shouldAttemptToOpenInPlace: true)
2
0
475
1d
How can a SwiftUI drag provide the actual file URL of an existing file on macOS (as NSOutlineView does)?
I'm dragging existing files from a SwiftUI List (a search result list in a sandboxed, document-based Mac app), and I want drop targets to receive the actual file URL — the same behavior as AppKit's NSOutlineView with outlineView(_:pasteboardWriterForItem:) returning an NSURL: the Finder copies the file, browsers load it, and text views insert its path. My current implementation is Transferable-based: FileRepresentation(exportedContentType: .data) { item in SentTransferredFile(item.fileURL, allowAccessingOriginalFile: true) } .suggestedFileName(\.fileURL.lastPathComponent) With this, what receivers get is a temporary copy in the app's own container (Caches/com.apple.SwiftUI.Drag-<UUID>/), not the actual file URL — despite allowAccessingOriginalFile: true. Dropping on the Finder or onto an application icon works through the copy, but receivers that interpret the URL itself — a browser window, or a text view that inserts the dropped file's path — see the temporary container path. Note that the dragged files live inside a folder the user has opened as a document (the app is NSDocument-based), so the app already holds security-scoped access to them. Alternatives don't help either: DataRepresentation(exportedContentType: .fileURL) returning the URL bytes of the actual file: the pasteboard data is likewise replaced with the copy's URL, and moreover, drops onto application icons (e.g. Safari in the Dock) are no longer accepted at all. onDrag with NSItemProvider(object: url as NSURL): same substitution. I've already filed this as FB23578716, with detailed reproduction steps and drag-pasteboard dumps. My questions: Is there any way in current SwiftUI (macOS 26/27 SDK) to put the real file URL of an existing file on the drag pasteboard? Is the rewriting to a temporary copy intended behavior (for sandbox safety), or a bug? If it's intended, is embedding an AppKit view that calls beginDraggingSession(with:event:source:) with an NSURL pasteboard writer the recommended workaround for now? It does write the real URL, but making it coexist with List's selection and click handling has proven fragile. Environment: macOS: macOS 27 Beta 2 / Version 26.5.2 Xcode: Version 27.0 Beta 2 App Sandbox enabled
3
0
111
1d
SwiftUI on macOS equivalent of NSSavePanel for choosing a destination URL?
In AppKit, NSSavePanel can be used to ask the user for a destination URL before the app creates a file. What is the SwiftUI equivalent for this? .fileImporter covers the NSOpenPanel case well enough, but I have not found a SwiftUI API that matches the simple NSSavePanel case where the app only needs the URL. There's a new API in .fileExporter that appears close, but it requires a non nil WritableDocument, and seems designed around SwiftUI performing the file export. My use case is a macOS app that creates new documents backed by SQLite. SQLite needs a file path so it can create the database at that location. With NSSavePanel, I can ask the user where to save the document, receive a URL, and then create the SQLite database myself. Is there a SwiftUI API for this on macOS 26 or later? If not, is NSSavePanel still the recommended approach for this case?
6
0
144
1d
SwiftUI ​Charts: In iOS 27, annotation overlays exceed the bounds of an annotation
I'm seeing a regression in SwiftUI Charts on iOS 27 beta 1. Any view placed inside a BarMark's overlay annotation no longer receives the size of the parent BarMark. It collapses to zero, so any content sized from geo.size (e.g. a Rectangle meant to fill the bar) renders empty or incorrectly. Expected: The GeometryReader reports the BarMark's rendered width/height, and the Rectangle fills the BarMark (this is the behavior in iOS 26 and earlier). Actual: On iOS 27 beta 1, geo.size is effectively zero, so the overlay content has an extremely small size. I suspect this could be a small bug with the new ContentBuilder / ViewBuilder changes but that's just a hunch. Here's a code sample which reproduces the issue. // MARK: - Mock Data Models struct ScheduleSeries: Identifiable { let id = UUID() let data: [ScheduleItem] } struct ScheduleItem: Identifiable { let id = UUID() let startDate: Date let startHour: Double let endHour: Double let secondaryText: String? } // MARK: - Minimal Reproducible Example struct ContentView: View { // Generate two consecutive days for the mock data let mockSchedule: [ScheduleSeries] = [ ScheduleSeries(data: [ ScheduleItem( startDate: Date(), startHour: 9.0, endHour: 11.5, secondaryText: "Morning Event" ), ScheduleItem( startDate: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, startHour: 13.0, endHour: 16.0, secondaryText: "Afternoon Event" ) ]) ] var body: some View { VStack(alignment: .leading) { Text("FB: Annotation Sizing Bug") .font(.headline) .padding(.bottom, 8) Text("Expected: The gray Rectangle should stretch to fill the BarMark.\nActual: GeometryReader/Annotation fails to size to the parent BarMark.") .font(.caption) .foregroundColor(.secondary) .padding(.bottom) Chart(mockSchedule) { series in ForEach(series.data, id: \.startDate) { element in BarMark( x: .value("Day", element.startDate, unit: .day, calendar: .current), yStart: .value("Start", element.startHour), yEnd: .value("End", element.endHour), width: .ratio(0.99) ) .annotation(position: .overlay, alignment: .topLeading) { item in ZStack { VStack(alignment: .leading, spacing: 0) { // BUG DEMONSTRATION: // This GeometryReader and Rectangle previously filled the BarMark, but in Xcode 27 it does not GeometryReader { geo in Rectangle() .fill(Color.black.opacity(0.15)) .frame(width: geo.size.width, height: geo.size.height) } } .foregroundColor(.white) .font(.caption2) } } } } .chartYScale(domain: 0...24) // Lock the Y-axis to a 24-hour scale } .padding() } } Environment: Xcode 27 beta 1 / iOS 27 beta 1 Reproduces on device and Simulator Worked as expected on iOS 26 and earlier Here's what the issue looks like in our app with zero code changes: iOS 26 iOS 27 I've filed a feedback report (FB23016343) with a sample project attached. Has anyone else hit this, or found a workaround for sizing overlay annotation content to a BarMark in iOS 27? Thanks!
2
0
161
1d
SwiftUI confirmationDialog in List inside .sheet is no longer anchored to the originating row on iOS 27 beta
Area SwiftUI → Presentation / ConfirmationDialog Summary After building with Xcode 27 beta, confirmationDialog presented from a row inside a List that is embedded in a .sheet is no longer anchored to the row that triggered it. Instead, the dialog is displayed near the top of the sheet when the sheet is partially expanded, or in the center of the screen when the sheet occupies the full height. This behavior is reproducible across all tested Xcode 27 beta releases and iOS 27 beta releases (Beta 1, Beta 2, and Beta 3). Steps to Reproduce Present a SwiftUI .sheet. Place a List inside the sheet. Add a confirmationDialog to each list row. Trigger the dialog from a swipe action on any row. Observe the position where the confirmation dialog appears. A minimal reproducible sample project is attached. Expected Result The confirmationDialog should be visually associated with the row that triggered it, as it behaved in previous Xcode and iOS releases. The dialog should appear anchored to the selected list row (or as close as the platform allows), providing clear contextual feedback to the user about which item is being acted upon. Actual Result The dialog is no longer associated with the selected row. When the sheet is not fully expanded, the dialog appears near the top area of the sheet, seemingly positioned relative to the sheet itself rather than the triggering row. When the sheet is expanded to full height, the dialog appears in the center of the screen. As a result, the relationship between the selected item and the confirmation dialog is lost, creating a confusing user experience. Regression Yes. The same implementation behaved correctly in previous Xcode and iOS versions. The issue first appeared after upgrading to Xcode 27 beta and remains present in all tested iOS 27 beta releases (Beta 1–3). Impact This is a significant UX regression for existing applications that rely on contextual confirmation dialogs within lists presented inside sheets. Applications that already have production users cannot easily redesign their interaction model to compensate for this behavior change. The previous behavior provided clear context about which list item was being acted upon, while the current behavior makes that association unclear. Configuration Xcode 27 Beta (all tested beta versions) iOS 27 Beta 1 iOS 27 Beta 2 iOS 27 Beta 3 Reproduced on physical devices Reproduced using the attached minimal sample project Attachments Minimal reproducible sample project. Screenshot showing expected behavior (prior implementation). Screenshot showing current behavior on iOS 27 Beta 3. Screen recording demonstrating the regression. struct ContentView: View { @State private var sheetIsPresented = false @State private var itemPendingDeletion: Int? = nil var array = Array(0...100) var body: some View { VStack { Text("Hello, world!") Button("Show List") { sheetIsPresented = true } } .sheet(isPresented: $sheetIsPresented) { List { ForEach(array, id: \.self) { value in ListRow(for: value) .confirmationDialog("Delete?", isPresented: Binding( get: { itemPendingDeletion == value }, set: { isPresented in if !isPresented { itemPendingDeletion = nil } } ) ) { Button { } label: { Text("Delete") } } .swipeActions(edge: .trailing) { Button { itemPendingDeletion = value } label: { Image(systemName: "trash") .foregroundStyle(.red) } } } .listRowInsets(EdgeInsets()) .listRowBackground(Color.clear) } .listStyle(.inset) .contentMargins(16, for: .scrollContent) .presentationDetents([.fraction(1), .fraction(0.9)]) } } @ViewBuilder private func ListRow(for value: Int) -> some View { Text("\(value)") .foregroundStyle(.primary) .padding(.vertical) .frame(maxWidth: .infinity) .background( RoundedRectangle(cornerRadius: 26, style: .continuous) ) .padding(.vertical, 2) } } #Preview { ContentView() } Xcode 27(Beta 1,2,3) Xcode 26.5
0
0
46
2d
SwiftUI confirmationDialog in List inside .sheet is no longer anchored to the originating row on iOS 27 beta
Area SwiftUI → Presentation / ConfirmationDialog Summary After building with Xcode 27 beta, confirmationDialog presented from a row inside a List that is embedded in a .sheet is no longer anchored to the row that triggered it. Instead, the dialog is displayed near the top of the sheet when the sheet is partially expanded, or in the center of the screen when the sheet occupies the full height. This behavior is reproducible across all tested Xcode 27 beta releases and iOS 27 beta releases (Beta 1, Beta 2, and Beta 3). Steps to Reproduce Present a SwiftUI .sheet. Place a List inside the sheet. Add a confirmationDialog to each list row. Trigger the dialog from a swipe action on any row. Observe the position where the confirmation dialog appears. A minimal reproducible sample project is attached. Expected Result The confirmationDialog should be visually associated with the row that triggered it, as it behaved in previous Xcode and iOS releases. The dialog should appear anchored to the selected list row (or as close as the platform allows), providing clear contextual feedback to the user about which item is being acted upon. Actual Result The dialog is no longer associated with the selected row. When the sheet is not fully expanded, the dialog appears near the top area of the sheet, seemingly positioned relative to the sheet itself rather than the triggering row. When the sheet is expanded to full height, the dialog appears in the center of the screen. As a result, the relationship between the selected item and the confirmation dialog is lost, creating a confusing user experience. Regression Yes. The same implementation behaved correctly in previous Xcode and iOS versions. The issue first appeared after upgrading to Xcode 27 beta and remains present in all tested iOS 27 beta releases (Beta 1–3). Impact This is a significant UX regression for existing applications that rely on contextual confirmation dialogs within lists presented inside sheets. Applications that already have production users cannot easily redesign their interaction model to compensate for this behavior change. The previous behavior provided clear context about which list item was being acted upon, while the current behavior makes that association unclear. Configuration Xcode 27 Beta (all tested beta versions) iOS 27 Beta 1 iOS 27 Beta 2 iOS 27 Beta 3 Reproduced on physical devices Reproduced using the attached minimal sample project Attachments Minimal reproducible sample project. Screenshot showing expected behavior (prior implementation). Screenshot showing current behavior on iOS 27 Beta 3. Screen recording demonstrating the regression. struct ContentView: View { @State private var sheetIsPresented = false @State private var itemPendingDeletion: Int? = nil var array = Array(0...100) var body: some View { VStack { Text("Hello, world!") Button("Show List") { sheetIsPresented = true } } .sheet(isPresented: $sheetIsPresented) { List { ForEach(array, id: \.self) { value in ListRow(for: value) .confirmationDialog("Delete?", isPresented: Binding( get: { itemPendingDeletion == value }, set: { isPresented in if !isPresented { itemPendingDeletion = nil } } ) ) { Button { } label: { Text("Delete") } } .swipeActions(edge: .trailing) { Button { itemPendingDeletion = value } label: { Image(systemName: "trash") .foregroundStyle(.red) } } } .listRowInsets(EdgeInsets()) .listRowBackground(Color.clear) } .listStyle(.inset) .contentMargins(16, for: .scrollContent) .presentationDetents([.fraction(1), .fraction(0.9)]) } } @ViewBuilder private func ListRow(for value: Int) -> some View { Text("\(value)") .foregroundStyle(.primary) .padding(.vertical) .frame(maxWidth: .infinity) .background( RoundedRectangle(cornerRadius: 26, style: .continuous) ) .padding(.vertical, 2) } } #Preview { ContentView() } Xcode 27(Beta 1,2,3) Xcode 26.5
0
0
30
2d
Reordering API crashes when if #available or .popover present
I've encountered crashes when trying to reorder items using the new reordering API. Fatal error: Unexpected identifier type. Expected UUID, got UUID To reproduce, simply run one of the 2 first tests and comment out the others: import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct Task: Identifiable { let id = UUID() var title: String } struct ContentView: View { @State private var tasks = [ Task(title: "Design Invoice"), Task(title: "Send Proposal"), Task(title: "Review Feedback"), Task(title: "Publish Update") ] @State private var showingPopover: Bool = false var body: some View { ScrollView { LazyVGrid( columns: [ GridItem(.adaptive(minimum: 100)) ] ) { ForEach(tasks) { task in // Test 1: This will crash when reordering if #available(iOS 26.0, macOS 26, *) { Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) } else { Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) } // Test 2: This will also crash Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) .popover(isPresented: $showingPopover) { Text("Popover") } // Test 3: This is ok Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) } .reorderable() } .reorderContainer(for: Task.self) { difference in tasks.apply(difference: difference) } } } } extension Array { mutating func apply<CollectionID: Hashable & Sendable>( difference: ReorderDifference<Element.ID, CollectionID> ) where Element: Identifiable, Element.ID: Sendable { // Find the source element that moved. guard let sourceIndex = firstIndex( where: { $0.id == difference.sources[0] } ) else { return } let movedElement = remove(at: sourceIndex) // Find the destination of that element. var destination: Int switch difference.destination.position { case let .before(value): guard let index = firstIndex( where: { $0.id == value } ) else { return } destination = index case .end: destination = endIndex } insert(movedElement, at: destination) } } I hope this is not just a limitation for the 27 release and is a bug that will be addressed in the next betas. Perhaps I'm just doing something wrong? In such case, thanks for pointing out what. FB23640379
Topic: UI Frameworks SubTopic: SwiftUI
1
0
45
2d
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
163
2d
iOS 27 beta 1: .scrollEdgeEffectStyle(.soft) renders fully transparent above safeAreaBar
Feedback ID: FB23086400 On iOS 27 beta 1, .scrollEdgeEffectStyle(.soft, for: .top) on a List underneath a custom .safeAreaBar(edge: .top) no longer renders the progressive fade-blur. The top edge is fully transparent — scrolled rows pass under the bar with no visual treatment at all, as if scrollEdgeEffectDisabled() had been applied. What I've verified so far: .hard renders correctly in the exact same hierarchy; only .soft is affected. The same binary works correctly on iOS 26.x Xcode preview. I'm building with Xcode 26.3 (iOS 26 SDK). Minimal reproduction: import SwiftUI struct EdgeEffectRepro: View { enum Style: String, CaseIterable, Identifiable { case automatic, soft, hard var id: Self { self } var value: ScrollEdgeEffectStyle { switch self { case .automatic: .automatic case .soft: .soft case .hard: .hard } } } @State private var style: Style = .soft @State private var useSystemBarOnly = false var body: some View { NavigationStack { List(0..<60, id: \.self) { i in Text("Row \(i)") .frame(maxWidth: .infinity, alignment: .leading) .listRowBackground( i.isMultiple(of: 2) ? Color.orange.opacity(0.45) : Color.teal.opacity(0.45) ) } .scrollIndicators(.hidden) .scrollEdgeEffectStyle(style.value, for: .top) .safeAreaBar(edge: .top) { if !useSystemBarOnly { VStack(spacing: 8) { HStack { Text("Custom Top Bar") .font(.system(size: 28, weight: .bold)) Spacer() } HStack { Text("Second row (e.g. date range picker)") .font(.caption) .foregroundStyle(.secondary) Spacer() } } .padding(.horizontal) } } .safeAreaInset(edge: .bottom) { VStack(spacing: 8) { Picker("Edge effect style", selection: $style) { ForEach(Style.allCases) { Text($0.rawValue).tag($0) } } .pickerStyle(.segmented) Toggle("System bar only (control group)", isOn: $useSystemBarOnly) .font(.caption) } .padding() .background(.regularMaterial) } .navigationTitle("EdgeEffect Repro") .navigationBarTitleDisplayMode(.inline) } } } Steps: run on iOS 27 beta 1, set the picker to soft, scroll rows under the bar. Expected: fade-blur as on iOS 26. Actual: fully transparent. Switch to hard: renders fine.
3
7
507
3d
Did VisionOS27 get the LazyVGrid Performance Updates?
Did VisionOS get the LazyVGrid Performance Updates that other platforms received? I’m observing that a LazyVGrid that works well on iPhone, iPad, and Mac appears to hitch and jitter as cells exit and renter the lazyVGrid on VisionOS. It really feels like it did not get the same behavior changes as the other platforms. I observe the scrollbar expands as cells leave the top of the grid, and each “exit” of a row seems to cause a hitch. I’ve got rigidly defined cell frames, rigidly defined columns. I don’t think any cells frames are being invalidated during scroll… (there’s no way to check this with instruments, right?) I‘ve made several analysis passes myself and threw the Xcode Agent with Codex at it just to scan for stuff, but it’s starting to just guess at things. Any known issues with VisionOS?
2
0
53
3d
How Did Apple Create the Fitness App Awards Animation?
Open your Apple Fitness app, I am facinated by the animation of the Awards screen, it is so smooth. Any idea how this was transiton created from a Grid/CollectionView to a RealityView? I assume the interative badge is a RealityView with a 3D model in there, but how the hell the transition was so smooth from the parent list screen to the detail screen.
0
0
54
3d
Request photo library authorization popup on macOS Catalyst can't be dismissed
I have an iOS app that I want to publish to the Mac App Store as a Catalyst app, but I noticed a situation where the app can't be closed and has to be force quit. The problem happens if the user has 0 photos in their Photo Library, and hits "Limited Access" on the request authorization prompt (In my case PHPhotoLibrary.requestAuthorization(for: .readWrite). Since the popup is a system prompt, I can't manually add a close button to it. I tried wrapping it in a view with a close button but the popup always shows up over any view I'm presenting within my app. If anyone has a workaround that would be greatly appreciated!
2
0
62
3d
Is NavigationSplitView on macOS 27 broken?
On macOS 27 Beta 2, a simple NavigationSplitView example exhibits bizarre behaviour when the window is resized. The sidebar seemingly expands and collapses at random as the window is resized. The symptoms can be exacerbated with toolbar items. The sidebar appears to behave correctly when an inspector view is not present. Copy paste the code below into a new Xcode 27 project and run on macOS 27 and then resize the window: File -> New -> Project... -> App import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { var body: some View { NavigationSplitView { Text("Sidebar") } detail: { Text("Content") } .inspector(isPresented: .constant(true)) { Text("Inspector") } } } Adding .frame or .inspectorColumnWidth to any of the Text views does not appear to fix the issues. macOS: 27.0 Beta (26A5368g) Xcode: 27.0 beta 2 (27A5209h)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2
1
133
3d
Pass data to an @Observable model
Overview I have a navigation split view. The detail view contains a model now this model depends on id from the parent view. Questions How can I pass data from the parent view and yet create the view in the detail view? Or should I be pass the model from the parent view, but the problem is the parent view needs to persist model. Or is there a better approach?
6
0
202
4d
NavigationStack has no animations or back gesture in macOS
When running a native macOS app using SwiftUI and a NavigationStack, clicking any links causes the contents of the stack to change immediately with no animation, and you can't use the usual two-finger swipe gesture to go back. The behavior is correct when running it as a Mac Catalyst app, you get the animated transitions when navigating, and swiping works. Minimal Example: (put this directly inside the WindowGroup) NavigationStack { VStack { NavigationLink { Rectangle().foregroundStyle(.red) } label: { Text("Button") } } }
0
0
47
4d
SwiftUI Slider onEditingChanged is unreliable on iOS 26
For information I stumbled upon a regression with SwiftUI Slider on iOS 26. Its onEditingChanged closure might be called twice when interaction ends, with a final Boolean incorrect value of true provided to the closure. As a result apps cannot reliably rely on this closure to detect when an interaction with the slider starts or ends. I filed a feedback under FB20283439 (iOS 26.0 regression: Slider onEditingChanged closure is unreliable).
8
10
647
5d
How to send a message from menu item in SwiftUI App to ContentView
I'm just not getting it. My app adds a custom Import menu item to the File menu. I want to have it tell the sole ContentView to run the fileImporter. Here's how I have it set up. Changing the showFileImporter variable to supposed to make stuff happen, but it doesn't change. @main struct Blah: App { @State public var contentView = ContentView(); var body:some Scene { WindowGroup { // ContentView() // It started out defining the content like normal, but I saw somewhere that if I declared it as a var up top, then I'd have an actual object that I could tell to do things, like calling the importTerms() method below. self.contentView } .commands { CommandGroup(after:.newItem) { Button("Import…") { contentView.importTerms(); } } } } struct ContentView: View { @State private var showFileImporter = false; var body: some View { VStack { ...stuff... } } .fileImporter(isPresented:$showFileImporter, allowedContentTypes:[.text], allowsMultipleSelection:false) { result in } public func importTerms() { print("\(showFileImporter)"); // ->false showFileImporter = true; print("\(showFileImporter)"); // ->yep, still false } } But it doesn't work. It calls importTerms(), and a breakpoint inside that method does get hit. But it doesn't change the value of showFileImporter and the fileImporter never appears. What kind of weird world has Swift made where setting a variable to true doesn't set it to true and there's no error at build or runtime?
Topic: UI Frameworks SubTopic: SwiftUI
Replies
10
Boosts
1
Views
103
Activity
22h
Changing a State var in a Timer block doesn't update the UI
Can anyone explain to me why my UI doesn't update after the timer fires in this code below? Even when the timer fires, the UI doesn't update. thanks, in advance for any guidance Mike struct ContentView: View { @State var referenceDate: Date = Date() init () { setupTimer() } func setupTimer() { let calendar = Calendar.current guard let triggerDate = calendar.nextDate( after: Date(), matching: DateComponents(hour: 14, minute: 46, second: 0), matchingPolicy: .nextTime ) else { return } let timer = Timer(fire: triggerDate, interval: 0.2, repeats: false) { _ in self.referenceDate = Date() print("runLoop!") } RunLoop.main.add(timer, forMode: .common) } var body: some View { VStack { Text("Ref time: \(referenceDate.formatted(date: .abbreviated, time: .standard))") } } }
Replies
2
Boosts
0
Views
52
Activity
1d
How to get the correct animation when inserting/removing a row in a SwiftUI List from a swipeAction?
Hello, In my app, I have a List with two sections. The first section contains favourited items. The second section contains all the items. I use a swipeAction to favorite / undo favorite an item. An item can be in the first section and in the second section. But when I use the swipeAction to perform the action, the row animation is conflicting with the List animation for insertion / removal (I think). It’s not synchronised and it leads to an ugly UX. GeometryGroup on the Section does not help. One solution is to delay the action so the swipe has enough time to go back to its original position but it’s hacky and depends too much on manual timing, etc. If I favorite / undo from a tap on the row (no swipe action), the animation is correct (obviously, as the row doesn’t need to animate to its original position). I experimented with a ScrollView + swipeActionsContainer() + swipeActions on iOS 27, and it works very nicely. But this solution only works for iOS 27 and my app targets iOS 18. So I would love to have a native implementation for iOS 18+ if possible. Am I missing something to get the correct animation with a List? You can check the attached code: https://gist.github.com/alpennec/f9de25cda29b515eb45af6b368a89ed8 Video: https://www.dropbox.com/scl/fi/sqitivihm4pbu8htxicap/ListSectionsSwipeActions.mov?rlkey=08wl708g82rmyy6nkf75725bv&st=0qb7rhdd&dl=0 I also filed a feedback with a video: FB23661327 Regards, Axel
Replies
1
Boosts
1
Views
46
Activity
1d
Drag and Drop stopped working after upgrading from macOS 15 to 26
When I drag and drop a file with flag "shouldAttemptToOpenInPlace: true", I was able to access the original file name in macOS 15. After upgrading to macOS 26, I can't access the original file name anymore. Instead, I got some useless file name such as ".com.apple.Foundation.NSItemProvider.gKZ91u.tmp". The app no longer works with these tmp filenames because it needs the orignal file name to do the file transfer. (Btw, this is a WinSCP like app on Mac platform) Could you please check and fix this issue? Thank you. FileRepresentation(contentType: .item, shouldAttemptToOpenInPlace: true)
Replies
2
Boosts
0
Views
475
Activity
1d
How can a SwiftUI drag provide the actual file URL of an existing file on macOS (as NSOutlineView does)?
I'm dragging existing files from a SwiftUI List (a search result list in a sandboxed, document-based Mac app), and I want drop targets to receive the actual file URL — the same behavior as AppKit's NSOutlineView with outlineView(_:pasteboardWriterForItem:) returning an NSURL: the Finder copies the file, browsers load it, and text views insert its path. My current implementation is Transferable-based: FileRepresentation(exportedContentType: .data) { item in SentTransferredFile(item.fileURL, allowAccessingOriginalFile: true) } .suggestedFileName(\.fileURL.lastPathComponent) With this, what receivers get is a temporary copy in the app's own container (Caches/com.apple.SwiftUI.Drag-<UUID>/), not the actual file URL — despite allowAccessingOriginalFile: true. Dropping on the Finder or onto an application icon works through the copy, but receivers that interpret the URL itself — a browser window, or a text view that inserts the dropped file's path — see the temporary container path. Note that the dragged files live inside a folder the user has opened as a document (the app is NSDocument-based), so the app already holds security-scoped access to them. Alternatives don't help either: DataRepresentation(exportedContentType: .fileURL) returning the URL bytes of the actual file: the pasteboard data is likewise replaced with the copy's URL, and moreover, drops onto application icons (e.g. Safari in the Dock) are no longer accepted at all. onDrag with NSItemProvider(object: url as NSURL): same substitution. I've already filed this as FB23578716, with detailed reproduction steps and drag-pasteboard dumps. My questions: Is there any way in current SwiftUI (macOS 26/27 SDK) to put the real file URL of an existing file on the drag pasteboard? Is the rewriting to a temporary copy intended behavior (for sandbox safety), or a bug? If it's intended, is embedding an AppKit view that calls beginDraggingSession(with:event:source:) with an NSURL pasteboard writer the recommended workaround for now? It does write the real URL, but making it coexist with List's selection and click handling has proven fragile. Environment: macOS: macOS 27 Beta 2 / Version 26.5.2 Xcode: Version 27.0 Beta 2 App Sandbox enabled
Replies
3
Boosts
0
Views
111
Activity
1d
SwiftUI on macOS equivalent of NSSavePanel for choosing a destination URL?
In AppKit, NSSavePanel can be used to ask the user for a destination URL before the app creates a file. What is the SwiftUI equivalent for this? .fileImporter covers the NSOpenPanel case well enough, but I have not found a SwiftUI API that matches the simple NSSavePanel case where the app only needs the URL. There's a new API in .fileExporter that appears close, but it requires a non nil WritableDocument, and seems designed around SwiftUI performing the file export. My use case is a macOS app that creates new documents backed by SQLite. SQLite needs a file path so it can create the database at that location. With NSSavePanel, I can ask the user where to save the document, receive a URL, and then create the SQLite database myself. Is there a SwiftUI API for this on macOS 26 or later? If not, is NSSavePanel still the recommended approach for this case?
Replies
6
Boosts
0
Views
144
Activity
1d
SwiftUI ​Charts: In iOS 27, annotation overlays exceed the bounds of an annotation
I'm seeing a regression in SwiftUI Charts on iOS 27 beta 1. Any view placed inside a BarMark's overlay annotation no longer receives the size of the parent BarMark. It collapses to zero, so any content sized from geo.size (e.g. a Rectangle meant to fill the bar) renders empty or incorrectly. Expected: The GeometryReader reports the BarMark's rendered width/height, and the Rectangle fills the BarMark (this is the behavior in iOS 26 and earlier). Actual: On iOS 27 beta 1, geo.size is effectively zero, so the overlay content has an extremely small size. I suspect this could be a small bug with the new ContentBuilder / ViewBuilder changes but that's just a hunch. Here's a code sample which reproduces the issue. // MARK: - Mock Data Models struct ScheduleSeries: Identifiable { let id = UUID() let data: [ScheduleItem] } struct ScheduleItem: Identifiable { let id = UUID() let startDate: Date let startHour: Double let endHour: Double let secondaryText: String? } // MARK: - Minimal Reproducible Example struct ContentView: View { // Generate two consecutive days for the mock data let mockSchedule: [ScheduleSeries] = [ ScheduleSeries(data: [ ScheduleItem( startDate: Date(), startHour: 9.0, endHour: 11.5, secondaryText: "Morning Event" ), ScheduleItem( startDate: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, startHour: 13.0, endHour: 16.0, secondaryText: "Afternoon Event" ) ]) ] var body: some View { VStack(alignment: .leading) { Text("FB: Annotation Sizing Bug") .font(.headline) .padding(.bottom, 8) Text("Expected: The gray Rectangle should stretch to fill the BarMark.\nActual: GeometryReader/Annotation fails to size to the parent BarMark.") .font(.caption) .foregroundColor(.secondary) .padding(.bottom) Chart(mockSchedule) { series in ForEach(series.data, id: \.startDate) { element in BarMark( x: .value("Day", element.startDate, unit: .day, calendar: .current), yStart: .value("Start", element.startHour), yEnd: .value("End", element.endHour), width: .ratio(0.99) ) .annotation(position: .overlay, alignment: .topLeading) { item in ZStack { VStack(alignment: .leading, spacing: 0) { // BUG DEMONSTRATION: // This GeometryReader and Rectangle previously filled the BarMark, but in Xcode 27 it does not GeometryReader { geo in Rectangle() .fill(Color.black.opacity(0.15)) .frame(width: geo.size.width, height: geo.size.height) } } .foregroundColor(.white) .font(.caption2) } } } } .chartYScale(domain: 0...24) // Lock the Y-axis to a 24-hour scale } .padding() } } Environment: Xcode 27 beta 1 / iOS 27 beta 1 Reproduces on device and Simulator Worked as expected on iOS 26 and earlier Here's what the issue looks like in our app with zero code changes: iOS 26 iOS 27 I've filed a feedback report (FB23016343) with a sample project attached. Has anyone else hit this, or found a workaround for sizing overlay annotation content to a BarMark in iOS 27? Thanks!
Replies
2
Boosts
0
Views
161
Activity
1d
SwiftUI confirmationDialog in List inside .sheet is no longer anchored to the originating row on iOS 27 beta
Area SwiftUI → Presentation / ConfirmationDialog Summary After building with Xcode 27 beta, confirmationDialog presented from a row inside a List that is embedded in a .sheet is no longer anchored to the row that triggered it. Instead, the dialog is displayed near the top of the sheet when the sheet is partially expanded, or in the center of the screen when the sheet occupies the full height. This behavior is reproducible across all tested Xcode 27 beta releases and iOS 27 beta releases (Beta 1, Beta 2, and Beta 3). Steps to Reproduce Present a SwiftUI .sheet. Place a List inside the sheet. Add a confirmationDialog to each list row. Trigger the dialog from a swipe action on any row. Observe the position where the confirmation dialog appears. A minimal reproducible sample project is attached. Expected Result The confirmationDialog should be visually associated with the row that triggered it, as it behaved in previous Xcode and iOS releases. The dialog should appear anchored to the selected list row (or as close as the platform allows), providing clear contextual feedback to the user about which item is being acted upon. Actual Result The dialog is no longer associated with the selected row. When the sheet is not fully expanded, the dialog appears near the top area of the sheet, seemingly positioned relative to the sheet itself rather than the triggering row. When the sheet is expanded to full height, the dialog appears in the center of the screen. As a result, the relationship between the selected item and the confirmation dialog is lost, creating a confusing user experience. Regression Yes. The same implementation behaved correctly in previous Xcode and iOS versions. The issue first appeared after upgrading to Xcode 27 beta and remains present in all tested iOS 27 beta releases (Beta 1–3). Impact This is a significant UX regression for existing applications that rely on contextual confirmation dialogs within lists presented inside sheets. Applications that already have production users cannot easily redesign their interaction model to compensate for this behavior change. The previous behavior provided clear context about which list item was being acted upon, while the current behavior makes that association unclear. Configuration Xcode 27 Beta (all tested beta versions) iOS 27 Beta 1 iOS 27 Beta 2 iOS 27 Beta 3 Reproduced on physical devices Reproduced using the attached minimal sample project Attachments Minimal reproducible sample project. Screenshot showing expected behavior (prior implementation). Screenshot showing current behavior on iOS 27 Beta 3. Screen recording demonstrating the regression. struct ContentView: View { @State private var sheetIsPresented = false @State private var itemPendingDeletion: Int? = nil var array = Array(0...100) var body: some View { VStack { Text("Hello, world!") Button("Show List") { sheetIsPresented = true } } .sheet(isPresented: $sheetIsPresented) { List { ForEach(array, id: \.self) { value in ListRow(for: value) .confirmationDialog("Delete?", isPresented: Binding( get: { itemPendingDeletion == value }, set: { isPresented in if !isPresented { itemPendingDeletion = nil } } ) ) { Button { } label: { Text("Delete") } } .swipeActions(edge: .trailing) { Button { itemPendingDeletion = value } label: { Image(systemName: "trash") .foregroundStyle(.red) } } } .listRowInsets(EdgeInsets()) .listRowBackground(Color.clear) } .listStyle(.inset) .contentMargins(16, for: .scrollContent) .presentationDetents([.fraction(1), .fraction(0.9)]) } } @ViewBuilder private func ListRow(for value: Int) -> some View { Text("\(value)") .foregroundStyle(.primary) .padding(.vertical) .frame(maxWidth: .infinity) .background( RoundedRectangle(cornerRadius: 26, style: .continuous) ) .padding(.vertical, 2) } } #Preview { ContentView() } Xcode 27(Beta 1,2,3) Xcode 26.5
Replies
0
Boosts
0
Views
46
Activity
2d
SwiftUI confirmationDialog in List inside .sheet is no longer anchored to the originating row on iOS 27 beta
Area SwiftUI → Presentation / ConfirmationDialog Summary After building with Xcode 27 beta, confirmationDialog presented from a row inside a List that is embedded in a .sheet is no longer anchored to the row that triggered it. Instead, the dialog is displayed near the top of the sheet when the sheet is partially expanded, or in the center of the screen when the sheet occupies the full height. This behavior is reproducible across all tested Xcode 27 beta releases and iOS 27 beta releases (Beta 1, Beta 2, and Beta 3). Steps to Reproduce Present a SwiftUI .sheet. Place a List inside the sheet. Add a confirmationDialog to each list row. Trigger the dialog from a swipe action on any row. Observe the position where the confirmation dialog appears. A minimal reproducible sample project is attached. Expected Result The confirmationDialog should be visually associated with the row that triggered it, as it behaved in previous Xcode and iOS releases. The dialog should appear anchored to the selected list row (or as close as the platform allows), providing clear contextual feedback to the user about which item is being acted upon. Actual Result The dialog is no longer associated with the selected row. When the sheet is not fully expanded, the dialog appears near the top area of the sheet, seemingly positioned relative to the sheet itself rather than the triggering row. When the sheet is expanded to full height, the dialog appears in the center of the screen. As a result, the relationship between the selected item and the confirmation dialog is lost, creating a confusing user experience. Regression Yes. The same implementation behaved correctly in previous Xcode and iOS versions. The issue first appeared after upgrading to Xcode 27 beta and remains present in all tested iOS 27 beta releases (Beta 1–3). Impact This is a significant UX regression for existing applications that rely on contextual confirmation dialogs within lists presented inside sheets. Applications that already have production users cannot easily redesign their interaction model to compensate for this behavior change. The previous behavior provided clear context about which list item was being acted upon, while the current behavior makes that association unclear. Configuration Xcode 27 Beta (all tested beta versions) iOS 27 Beta 1 iOS 27 Beta 2 iOS 27 Beta 3 Reproduced on physical devices Reproduced using the attached minimal sample project Attachments Minimal reproducible sample project. Screenshot showing expected behavior (prior implementation). Screenshot showing current behavior on iOS 27 Beta 3. Screen recording demonstrating the regression. struct ContentView: View { @State private var sheetIsPresented = false @State private var itemPendingDeletion: Int? = nil var array = Array(0...100) var body: some View { VStack { Text("Hello, world!") Button("Show List") { sheetIsPresented = true } } .sheet(isPresented: $sheetIsPresented) { List { ForEach(array, id: \.self) { value in ListRow(for: value) .confirmationDialog("Delete?", isPresented: Binding( get: { itemPendingDeletion == value }, set: { isPresented in if !isPresented { itemPendingDeletion = nil } } ) ) { Button { } label: { Text("Delete") } } .swipeActions(edge: .trailing) { Button { itemPendingDeletion = value } label: { Image(systemName: "trash") .foregroundStyle(.red) } } } .listRowInsets(EdgeInsets()) .listRowBackground(Color.clear) } .listStyle(.inset) .contentMargins(16, for: .scrollContent) .presentationDetents([.fraction(1), .fraction(0.9)]) } } @ViewBuilder private func ListRow(for value: Int) -> some View { Text("\(value)") .foregroundStyle(.primary) .padding(.vertical) .frame(maxWidth: .infinity) .background( RoundedRectangle(cornerRadius: 26, style: .continuous) ) .padding(.vertical, 2) } } #Preview { ContentView() } Xcode 27(Beta 1,2,3) Xcode 26.5
Replies
0
Boosts
0
Views
30
Activity
2d
Reordering API crashes when if #available or .popover present
I've encountered crashes when trying to reorder items using the new reordering API. Fatal error: Unexpected identifier type. Expected UUID, got UUID To reproduce, simply run one of the 2 first tests and comment out the others: import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct Task: Identifiable { let id = UUID() var title: String } struct ContentView: View { @State private var tasks = [ Task(title: "Design Invoice"), Task(title: "Send Proposal"), Task(title: "Review Feedback"), Task(title: "Publish Update") ] @State private var showingPopover: Bool = false var body: some View { ScrollView { LazyVGrid( columns: [ GridItem(.adaptive(minimum: 100)) ] ) { ForEach(tasks) { task in // Test 1: This will crash when reordering if #available(iOS 26.0, macOS 26, *) { Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) } else { Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) } // Test 2: This will also crash Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) .popover(isPresented: $showingPopover) { Text("Popover") } // Test 3: This is ok Text(task.title) .frame(maxWidth: .infinity) .padding() .background(.blue.opacity(0.1)) .clipShape(.rect(cornerRadius: 12)) } .reorderable() } .reorderContainer(for: Task.self) { difference in tasks.apply(difference: difference) } } } } extension Array { mutating func apply<CollectionID: Hashable & Sendable>( difference: ReorderDifference<Element.ID, CollectionID> ) where Element: Identifiable, Element.ID: Sendable { // Find the source element that moved. guard let sourceIndex = firstIndex( where: { $0.id == difference.sources[0] } ) else { return } let movedElement = remove(at: sourceIndex) // Find the destination of that element. var destination: Int switch difference.destination.position { case let .before(value): guard let index = firstIndex( where: { $0.id == value } ) else { return } destination = index case .end: destination = endIndex } insert(movedElement, at: destination) } } I hope this is not just a limitation for the 27 release and is a bug that will be addressed in the next betas. Perhaps I'm just doing something wrong? In such case, thanks for pointing out what. FB23640379
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
45
Activity
2d
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
163
Activity
2d
iOS 27 beta 1: .scrollEdgeEffectStyle(.soft) renders fully transparent above safeAreaBar
Feedback ID: FB23086400 On iOS 27 beta 1, .scrollEdgeEffectStyle(.soft, for: .top) on a List underneath a custom .safeAreaBar(edge: .top) no longer renders the progressive fade-blur. The top edge is fully transparent — scrolled rows pass under the bar with no visual treatment at all, as if scrollEdgeEffectDisabled() had been applied. What I've verified so far: .hard renders correctly in the exact same hierarchy; only .soft is affected. The same binary works correctly on iOS 26.x Xcode preview. I'm building with Xcode 26.3 (iOS 26 SDK). Minimal reproduction: import SwiftUI struct EdgeEffectRepro: View { enum Style: String, CaseIterable, Identifiable { case automatic, soft, hard var id: Self { self } var value: ScrollEdgeEffectStyle { switch self { case .automatic: .automatic case .soft: .soft case .hard: .hard } } } @State private var style: Style = .soft @State private var useSystemBarOnly = false var body: some View { NavigationStack { List(0..<60, id: \.self) { i in Text("Row \(i)") .frame(maxWidth: .infinity, alignment: .leading) .listRowBackground( i.isMultiple(of: 2) ? Color.orange.opacity(0.45) : Color.teal.opacity(0.45) ) } .scrollIndicators(.hidden) .scrollEdgeEffectStyle(style.value, for: .top) .safeAreaBar(edge: .top) { if !useSystemBarOnly { VStack(spacing: 8) { HStack { Text("Custom Top Bar") .font(.system(size: 28, weight: .bold)) Spacer() } HStack { Text("Second row (e.g. date range picker)") .font(.caption) .foregroundStyle(.secondary) Spacer() } } .padding(.horizontal) } } .safeAreaInset(edge: .bottom) { VStack(spacing: 8) { Picker("Edge effect style", selection: $style) { ForEach(Style.allCases) { Text($0.rawValue).tag($0) } } .pickerStyle(.segmented) Toggle("System bar only (control group)", isOn: $useSystemBarOnly) .font(.caption) } .padding() .background(.regularMaterial) } .navigationTitle("EdgeEffect Repro") .navigationBarTitleDisplayMode(.inline) } } } Steps: run on iOS 27 beta 1, set the picker to soft, scroll rows under the bar. Expected: fade-blur as on iOS 26. Actual: fully transparent. Switch to hard: renders fine.
Replies
3
Boosts
7
Views
507
Activity
3d
Did VisionOS27 get the LazyVGrid Performance Updates?
Did VisionOS get the LazyVGrid Performance Updates that other platforms received? I’m observing that a LazyVGrid that works well on iPhone, iPad, and Mac appears to hitch and jitter as cells exit and renter the lazyVGrid on VisionOS. It really feels like it did not get the same behavior changes as the other platforms. I observe the scrollbar expands as cells leave the top of the grid, and each “exit” of a row seems to cause a hitch. I’ve got rigidly defined cell frames, rigidly defined columns. I don’t think any cells frames are being invalidated during scroll… (there’s no way to check this with instruments, right?) I‘ve made several analysis passes myself and threw the Xcode Agent with Codex at it just to scan for stuff, but it’s starting to just guess at things. Any known issues with VisionOS?
Replies
2
Boosts
0
Views
53
Activity
3d
How Did Apple Create the Fitness App Awards Animation?
Open your Apple Fitness app, I am facinated by the animation of the Awards screen, it is so smooth. Any idea how this was transiton created from a Grid/CollectionView to a RealityView? I assume the interative badge is a RealityView with a 3D model in there, but how the hell the transition was so smooth from the parent list screen to the detail screen.
Replies
0
Boosts
0
Views
54
Activity
3d
Request photo library authorization popup on macOS Catalyst can't be dismissed
I have an iOS app that I want to publish to the Mac App Store as a Catalyst app, but I noticed a situation where the app can't be closed and has to be force quit. The problem happens if the user has 0 photos in their Photo Library, and hits "Limited Access" on the request authorization prompt (In my case PHPhotoLibrary.requestAuthorization(for: .readWrite). Since the popup is a system prompt, I can't manually add a close button to it. I tried wrapping it in a view with a close button but the popup always shows up over any view I'm presenting within my app. If anyone has a workaround that would be greatly appreciated!
Replies
2
Boosts
0
Views
62
Activity
3d
NavigationView different in iOS27
Hi! I'm updated to iOS 27 beta and see the navigationView with title is not translucid & grandient anymore, how to make it translucid and gradient back? Example in iOS 26 and iOS 27
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
80
Activity
3d
Is NavigationSplitView on macOS 27 broken?
On macOS 27 Beta 2, a simple NavigationSplitView example exhibits bizarre behaviour when the window is resized. The sidebar seemingly expands and collapses at random as the window is resized. The symptoms can be exacerbated with toolbar items. The sidebar appears to behave correctly when an inspector view is not present. Copy paste the code below into a new Xcode 27 project and run on macOS 27 and then resize the window: File -> New -> Project... -> App import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { var body: some View { NavigationSplitView { Text("Sidebar") } detail: { Text("Content") } .inspector(isPresented: .constant(true)) { Text("Inspector") } } } Adding .frame or .inspectorColumnWidth to any of the Text views does not appear to fix the issues. macOS: 27.0 Beta (26A5368g) Xcode: 27.0 beta 2 (27A5209h)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
2
Boosts
1
Views
133
Activity
3d
Pass data to an @Observable model
Overview I have a navigation split view. The detail view contains a model now this model depends on id from the parent view. Questions How can I pass data from the parent view and yet create the view in the detail view? Or should I be pass the model from the parent view, but the problem is the parent view needs to persist model. Or is there a better approach?
Replies
6
Boosts
0
Views
202
Activity
4d
NavigationStack has no animations or back gesture in macOS
When running a native macOS app using SwiftUI and a NavigationStack, clicking any links causes the contents of the stack to change immediately with no animation, and you can't use the usual two-finger swipe gesture to go back. The behavior is correct when running it as a Mac Catalyst app, you get the animated transitions when navigating, and swiping works. Minimal Example: (put this directly inside the WindowGroup) NavigationStack { VStack { NavigationLink { Rectangle().foregroundStyle(.red) } label: { Text("Button") } } }
Replies
0
Boosts
0
Views
47
Activity
4d
SwiftUI Slider onEditingChanged is unreliable on iOS 26
For information I stumbled upon a regression with SwiftUI Slider on iOS 26. Its onEditingChanged closure might be called twice when interaction ends, with a final Boolean incorrect value of true provided to the closure. As a result apps cannot reliably rely on this closure to detect when an interaction with the slider starts or ends. I filed a feedback under FB20283439 (iOS 26.0 regression: Slider onEditingChanged closure is unreliable).
Replies
8
Boosts
10
Views
647
Activity
5d