Search results for

SwiftUI List performance

50,605 results found

Post

Replies

Boosts

Views

Activity

Reply to How does Xcode26.3 Agent know about the API Documentation for non Apple Intelligence
XcodeRead - Read files from the project XcodeWrite - Write files to the project XcodeUpdate - Edit files with str_replace-style patches XcodeGlob - Find files by pattern XcodeGrep - Search file contents XcodeLS - List directory contents XcodeMakeDir - Create directories XcodeRM - Remove files XcodeMV - Move/rename files BuildProject - Build the Xcode project GetBuildLog - Get build output RunAllTests - Run all tests RunSomeTests - Run specific tests GetTestList - List available tests XcodeListNavigatorIssues - Get Xcode issues/errors XcodeRefreshCodeIssuesInFile - Get live diagnostics ExecuteSnippet - Run code in a REPL-like environment RenderPreview - Render SwiftUI previews as images DocumentationSearch - Search Apple docs and WWDC videos XcodeListWindows - List open Xcode windows The above is a list of MCPTools exposed by Xcode. Im am interested in the DocumentationSearch Tool . Here Xcode is able to search only Apple Docs. Lets say i am using a custom .xcframew
2w
Does Showing User's Current Location on the Map Require 'NSLocationWhenInUseUsageDescription'?
I have a desktop application that shows some real estate properties chosen by the user. The application shows those GPP locations on the map. The SwiftUI code is something like the following. import SwiftUI import MapKit struct ContentView: View { var body: some View ZStack { mapView } } private var mapView: some View { Map(position: $propertyViewModel.mapPosition) { ForEach(propertyViewModel.properties) { property in Annotation(, coordinate: CLLocationCoordinate2D(latitude: property.lat, longitude: property.lon)) { Button { } label: { VStack { Image(systemName: house.circle.fill) .resizable() .scaledToFit() .frame(width: 48) .foregroundStyle(colorScheme == .light ? .white : .black) ... } } .buttonStyle(.borderless) } } UserAnnotation() } .mapControls { MapUserLocationButton() } .mapControlVisibility(.visible) .onAppear { CLLocationManager().requestWhenInUseAuthorization() } } } The application only wants to use the CLLocationManager class so that it can show those locations on the map relat
1
0
120
2w
Background Assets: Second and subsequent download cancellations fail (iOS 26.0–26.3 RC)
Summary I'm using Background Assets to download Apple-hosted Asset Packs(downloadPolicy = onDemand). The first download cancellation succeeds, but on the second and subsequent downloads, progress.cancel() fails to work and the download completes to the end. Environment iOS 26.0 – 26.3 RC (all produce the same result) Xcode Version 26.2 (17C52) Using Apple-hosted Asset Packs Steps to Reproduce Start downloading an Asset Pack Call progress.cancel() during download → Succeeds Start downloading the same Asset Pack again Call progress.cancel() during download → Fails (download completes to the end) Observed Error Logs After 1st cancellation: A download with the ID X-XXXXXXXX-XXX failed: Error Domain=NSURLErrorDomain Code=-999 cancelled ↑ This is expected (cancellation succeeded) The fact that version 0 of the asset pack with the ID X-XXXXXX-XXX finished being downloaded couldn't be reported: Error Domain=NSCocoaErrorDomain Code=3851 Property list invalid for format: 200 (property lists cannot con
1
0
84
2w
Reply to System Panic with IOUserSCSIParallelInterfaceController during Dispatch Queue Configuration
Part 2... Does this indicate a specific alignment restriction, memory fragmentation, or a resource conflict on Apple Silicon? No, I don't think anything like that is going on. Synchronization for Memory Visibility: To ensure that the virtual address mapping established in UserMap... is globally visible across all CPU cores and execution contexts before the kernel issues the first Bundled Task, are there recommended synchronization primitives or Memory Barrier calls? No, I don't think any special synchronization is required. If you're tracking the buffer through a direct pointer, then the relative gap between UserMapBundledParallelTaskCommandAndResponseBuffers and the first possible call to BundledParallelTaskCompletion is so large that any kind of synchronization is unnecessary. This is also a fine reason to not bother holding/freeing the IOMemoryMap— if you never free your buffer pointer, then its values will only EVER be NULL (uninitialized) or its valid value (post initialized). The more I think about this
Topic: App & System Services SubTopic: Drivers Tags:
2w
Reply to System Panic with IOUserSCSIParallelInterfaceController during Dispatch Queue Configuration
Part 1... However, a subsequent call to ivars->fResponseMap->GetAddress() returns NULL (0x0). Subsequent call when? The expectation (and what our driver does) is that you'd immediately call GetAddress() and then basically never look at the map again. In one of our drivers, that never is quite literal. The code is basically: IOMemoryMap *memoryMap = NULL; if ( parallelCommandIOMemoryDescriptor->CreateMapping(0, 0, 0, 0, 0, &memoryMap) == kIOReturnSuccess ) { ivars->fCommandAddress = memoryMap->GetAddress(); } ... if ( parallelResponseIOMemoryDescriptor->CreateMapping(0, 0, 0, 0, 0, &memoryMap) == kIOReturnSuccess ) { ivars->fParallelResponseAddress = memoryMap->GetAddress(); } ...and, yes, that code leaks two IOMemoryMap's. I don't know what the exact thinking was, but I suspect they realized that the only reason that mapping would ever become invalid/useless was because the driver was being torn down, so freeing doesn't really matter. I'll admit, there is a certain charm to tha
Topic: App & System Services SubTopic: Drivers Tags:
2w
Reply to Can I disable a SwiftUI View from being a draggable source, but still leave it enabled as a dropDestination?
Thank you for your question. I recommend providing a focused sample project, such as the image Image(“playerJersey_red”), which we will all be missing. I will need to replace it with a different image. Regarding the dropDestination cellContent, I understand that you define it, but it would be beneficial to have a sample that can be executed quickly and shared with others for verification. I think it is possible to have a view enabled as a drop destination but disabled as a draggable source based on certain conditions. The issue you're encountering with the .disabled modifier affecting both dragging and dropping could be because it disables all user interactions for the view. Instead, you should conditionally apply the .draggable modifier only when there is a player available? Use content.player.map { $0 } to provide a value only when player is not nil. This makes the view draggable only if a player exists and should keep the .dropDestination modifier without any conditions since you want all cells to be valid
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w
Reply to Delete Confirmation Dialog Inside Toolbar IOS26
Figured out the implementation! For anyone interested in implementing in IOS 26+ @Namespace private var namespace @State private var presentDialog: Bool = false and in the toolbar ToolbarItem(placement: .cancellationAction){ Button(role: .destructive) { presentDialog = true } label: { Text(Delete) } .confirmationDialog( Delete?, isPresented: $presentDialog, titleVisibility: .visible ) { Button(Delete, role: .destructive) { // perform delete } Button(Cancel, role: .cancel) { } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w
Can I disable a SwiftUI View from being a draggable source, but still leave it enabled as a dropDestination?
My app has a collection of Cell Views. some of the views' model objects include a Player, and others do not. I want to use drag and drop to move a player from one cell to another. I only want cells that contain a player to be valid drag sources. All cells will be valid drop destinations. When I uncomment the .disabled line both drag and drop become disabled. Is it possible to keep a view enabled as a dropDestination but disabled as a draggable source? VStack { Image(playerJersey_red) if let player = content.player { Text(player.name) } } .draggable(content) // .disabled(content.player == nil) .dropDestination(for: CellContent.self) { items, location in One thing I tried was to wrap everything in a ZStack and put a rectangle with .opacity(0.02) above the Image/Text VStack. I then left draggable modifying my VStack and moved dropDestination to the clear rectangle. This didn't work as I wasn't able to initiate a drag when tapping on the rectangle. Any other ideas or suggestions? thanks
4
0
174
2w
Reply to Getting a list of deleted CloudKit records with an expired change token
Hi Ziqiao, The important detail is step 3 - the user hasn't even opened Device B in weeks so that device is totally out of the loop. It's unaware of any deletions (or any changes at all) that have happened since step 1. Everything was synchronized initially, but then the user starts deleting items on Device A, which get synced up to iCloud. Meanwhile, back on device B, the app has been left unopened for weeks. When the user opens it up, they'll get .changeTokenExpired, and I'll fall back to the unify logic, the same behavior we use the first time this device syncs. I'm really confused about how deleted record ID's work. For my use case, it doesn't matter which device the record was created on - any device that has had a long delay between fetches such that it needs to do a full fetch will need a list of everything that was deleted on the server since the last fetch. For example, a user initially creates a record on Device A, syncs it to iCloud, Device B fetches. Later on, the user removes it on Devic
2w
Transperent title bar changed to gray when refocus
Hello, I'm trying to create game in macos with transperent titlebar. The title bar t stay transperent when I click inside, but changed to gray when the window resize or get out of focus. How can I make it stay transperent all the time? I did all of this: window.styleMask.insert(.fullSizeContentView) window.titlebarAppearsTransparent = true window.titlebarSeparatorStyle = .none window.titleVisibility = .hidden window.isMovableByWindowBackground = true window.isOpaque = false window.backgroundColor = .black in the swiftUI view created zstack that start with: var body: some View { ZStack { Color.black.ignoresSafeArea() help please :) Thanks.
Topic: UI Frameworks SubTopic: General
2
0
164
2w
How do i use dynamic data for my SwiftUI ScrollView without destroying performance?
Currently i am trying really hard to create experience like the Apple fitness app. So the main view is a single day and the user can swipe between days. The week would be displayed in the toolbar and provide a shortcut to scroll to the right day. I had many attempts at solving this and it can work. You can create such an interface with SwiftUI. However, changing the data on every scroll makes limiting view updates hard and additionally the updates are not related to my code directly. Instruments show me long updates, but they belong to SwiftUI and all the advice i found does not apply or help. struct ContentView: View { @State var journey = JourneyPrototype(selection: 0) @State var position: Int? = 0 var body: some View { ScrollView(.horizontal) { LazyHStack(spacing: 0) { ForEach(journey.collection, id: .self) { index in Listing(index: index) .id(index) } } .scrollTargetLayout() } .scrollTargetBehavior(.paging) .scrollPosition(id: $position) .onChange(of: position) { oldValue, newVa
0
0
66
2w
Reply to SwiftUI onChange fires twice when filtering data from @Observable store
@DTS Engineer Thanks a lot for the detailed explanation — that makes sense. It seems that when migrating directly from ObservableObject to @Observable, extra care is needed around update ordering and intermediate states. In my case, this behavior leads to unexpected UI results, such as the scroll position ending up in an incorrect state (as shown in the screenshot above). I can consistently reproduce this on a real iPad Pro (M4) running iOS 26.2.1, where the UI visually jumps and then settles at an unintended position. I’ll need to adjust my approach to work around this behavior. I’d also be very interested to hear more from the SwiftUI team on the intended patterns or best practices for avoiding these intermediate states in UI code.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w
Reply to SwiftUI onChange fires twice when filtering data from @Observable store
This is a very interesting question, and you've done a great job of isolating the behavior and providing comparative examples. I’m not an expert on SwiftUI, wish I knew better, but that technology was always being really good at what you're seeing this double update with @Observable and @State, especially in conjunction with GeometryReader. When @Published properties change, they emit events. Views that are observing these properties (via @StateObject or @EnvironmentObject) then get scheduled for re-evaluation. The update cycle is generally more straightforward: state change -> event -> view re-render. filteredAlbums id: [3878E7A7-CDAB-444F-8B8C-263763735770, 1, 2, 3, 4, 5, 6] filteredAlbums id: [1, 2, 3, 4, 5, 6] You've triggered two state changes almost simultaneously: albumStore.addAlbum(newAlbum): This is a change to a property managed by your @Observable AlbumStore. albumToAdd = newAlbum: This is a change to a @State property within your view. Your carousel() function reads from albumStore
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w
Reply to Virtual Machine UDID Changes in macOS 15: Looking for Guidance on Development Workflow
Oh, and I forgot to mention a couple of random caveats for the old hardware model technique I explained in the previous post: By bringing up a new OS on an old hardware model VM, you miss out on various features. Indeed, that’s kinda the point, in that you want to ‘miss out’ on the new-style provisioning UDIDs. However, there are other features, like using iCloud, that you might actually miss. And it’s not hard to imagine that list growing in the future. And speaking of the future, there’s no guarantee that this technique will work forever. I can imagine a world where a macOS NN guest simply won’t run on older hardware model VMs. Or that a old hardware model might stop being supported by the macOS host. You can detect the latter with isSupported, but the former is likely to result in either the OS failing to install or the OS not booting once it is installed. So, your default path should be to create your VM in the standard way, as illustrated by the Running macOS in a virtual machine on Apple silico
Topic: App & System Services SubTopic: Core OS Tags:
2w
Reply to In a List row on macOS, changing Image color when row is selected
Thank you for your reply! I understand now, and was able to fix our code. I’d read the documentation page too quickly and misunderstood what it was saying exactly. It's pretty interesting that you need to read the environment not from within the row view, but from a descendant of it. For anyone else reading this, here’s some additional tests that helped me understand exactly the required setup. The third row especially (ListItemThinWrapper) seems to suggest you should be thinking in terms of resolved views, or something like that. struct ProminentBackgroundInList: View { var body: some View { List(selection: .constant(Set([0, 1, 2, 3]))) { ListItem().tag(0) // doesn't work ZStack { ListItem() // works }.tag(1) ListItemThinWrapper().tag(2) // doesn't work ListItemStackWrapper().tag(3) // works } } struct ListItem: View { @Environment(.backgroundProminence) var backgroundProminence var body: some View { HStack { Image(systemName: person.fill) .foregroundStyle(backgroundProminence == .standard ? .orange
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2w