Search results for

SwiftUI List performance

50,611 results found

Post

Replies

Boosts

Views

Activity

Sizing SpriteView inside a List
I am trying to display a SKScene inside a SwiftUI list but I'm having problems getting it to size properly. Here is the code I'm using: struct MyView: View { var scene: SKScene // this is a SKScene with .aspectFit scaling mode var body: some View { List { Section { GeometryReader { geo in SpriteView(scene: scene, options: [.allowTransparency]) .frame(height: geo.size.width / scene.size.width * scene.size.height) } } Section { Text(SomeOtherStuff) } } } } Doing this scales the actual SKScene properly but the list 'cell' doesn't stretch to fit the scene it contains, therefore clipping chunks of said scene. If I drop the GeometryReader and hard code the height, the cell resizes. My guess is that the SKScene dimensions are not yet available to SwiftUI when the GeometryReader is evaluated. Any suggestions?
2
0
571
Jan ’24
Reply to macOS 15.5 destroys SwiftUI Table Performance
@lehrtim No. The issue is unresolved. I had hoped that macOS 26 would prove better—especially since the WWDC sessions called out massive improvements in Table performance for large data sets, but that appears to be vaporware. I see far worse performance on 15.5 and 26 than I did on macOS 15.4. Unfortunately, the best advice I can offer is: stay away from SwiftUI Table. Use AppKit and NSTableView directly.
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’25
How to Use a Button in navigationBarItems to Work with List
I have the following lines of code to work with a list of strings. import SwiftUI struct ContentView: View { @State private var users = [George, Kenny, Susan, Natalie] var body: some View { NavigationView { List { ForEach(users, id: .self) { user in Text(user) } .onDelete(perform: delete) } .navigationBarTitle(My family) .toolbar { EditButton() } } } func delete(at offsets: IndexSet) { users.remove(atOffsets: offsets) } } Now, I'm doing the following out of curiosity. Now, I have a button in naviationBarItems. And I wonder if I can turn on and off the edit feature of the list with the button? struct ContentView: View { @State private var users = [George, Kenny, Susan, Natalie] var body: some View { NavigationView { List { ForEach(users, id: .self) { user in Text(user) } } .navigationBarTitle(My family) .navigationBarItems(trailing: Button(action: { print(Edit button pressed...) }) { Text(Edit) } ) } } } Muchos thankos.
1
0
527
Sep ’21
Bug in SwiftUI?
Hi, so I have been learning SwiftUI and writing an app. I have found out that the following code won't compile and neither Xcode shows the preview of that view. Instead Xcode will display this error message when I try to preview it: Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project Just to demonstrate this issue, all MVVM code are in a single file. Here's my code: // Model struct WatchListModel { let m_id: Int let m_ticker_symbol: String } // View struct WatchlistView: View { @ObservedObject var m_watch_list_view_model: WatchListViewModel init(watch_list_view_model: WatchListViewModel) { m_watch_list_view_model = watch_list_view_model } var body: some View { // This view is causing that issue List(m_watch_list_view_model.m_watch_list_model) { watch_list_model in Text(watch_list_model.m_ticker_symbol) }.onAppear(perform: { self.m_watch_list_view_model.populate_watch_list() }) } } extension
1
0
1.9k
Aug ’21
how to do bulk core data update with swiftui
i have an swiftui + coredata app. i want to do the following two things: bulk delete -> a user selects multiple records from list view and when a delete button is clicked, the records selected are deleted bulk update -> a user selects multiple records from list view. and when an edit button is clicked, a new view is pops up where the user can enter what attributes they want to change bulk delete (#1) is working in edit mode by implementing https://stackoverflow.com/questions/57784859/swiftui-how-to-perform-action-when-editmode-changes however, for bulk update (#2), i had a similar code for bulk delete; displaying an update button when in edit mode, but it would not go to other view where i wanted to display list of attributes and update core data and i read the behavior is expected. i have no idea how i can go to other view with the information of which data is selected. i am pretty new to swiftui + coredata. Any idea/suggestion would be app
0
0
592
Oct ’20
SwiftUI's List backed by CoreData using @FetchRequest fails to update on iOS 26 when compiled with Xcode 26
Hey there! I've been tracking a really weird behavior with a List backed by @FetchRequest from CoreData. When I toggle a bool on the CoreData model, the first time it updates correctly, but if I do it a second time, the UI doesn't re-render as expected. This does not happen if I compile the app using Xcode 16 (targeting both iOS 18 and iOS 26), nor it happens when using Xcode 26 and targeting iOS 18. It only happens when building the app using Xcode 26 and running it on iOS 26. Here are two demos: the first one works as expected, when I toggle the state twice, both times updates. The second one, only on iOS 26, the second toggle fails to re-render. Demo (running from Xcode 16): Demo (running from Xcode 26): The code: import SwiftUI import CoreData @main struct CoreDataTestApp: App { let persistenceController = PersistenceController.shared var body: some Scene { WindowGroup { ContentView() .environment(.managedObjectContext, persistenceController.container.viewContext) } } } struct ContentVie
5
0
287
Aug ’25
MDLVoxelArray performance
I've been playing around with the MDLVoxelArray functionality in iOS, to create a mesh algorithmically via voxels. Currently I create the voxel array like this: let minBounds = vector_float3(x: 0.0, y: 0.0, z: 0.0) let maxBounds = vector_float3(x: Float(width), y: Float(height), z: Float(maxDepth)) let boundingBox = MDLAxisAlignedBoundingBox(maxBounds: maxBounds, minBounds: minBounds) let voxels = MDLVoxelArray(data: Data(capacity: MemoryLayout<MDLVoxelIndex>.size * width * height * depth), boundingBox: boundingBox, voxelExtent: 1.0) Then I populate it with indices: var index = MDLVoxelIndex(x: 0, y: 0, z: 0, w: 0) for i in 0 ..< height { ttfor j in 0 ..< width { ttttindex.x = Int32(j) ttttindex.y = Int32(i) ttttlet depth = Int32(heightMap[j][i]) ttttlet midPoint = depth / 2 tttttttt ttttfor k in 0 ... depth { tttttt// w should be 0 at the surface and increase in magnitude towards the middle ttttttlet w = abs(k - midPoint) - midPoint ttttttindex.z = k ttttttindex.w = w ttttttvoxels.setVoxelAtIndex
1
0
918
Jul ’20
DeviceActivityReport lag and performance issues
I've been experiencing some serious performance issues with DeviceActivityReport. Their severity tends to vary across devices - for some of my users it's really bad and for some it's mostly fine - but every device seems to experience these issues at some point. 1. DeviceActivityReport is completely blank. Often on launch, the DeviceActivityReport is completely blank and the only way to make it show up is to click back and forth between tabs, or quit the app and re-open it. Sometimes, it will show up after one or two seconds, but that is still a bad user experience. When looking at logs during this issue, I can see that makeConfiguration still runs successfully and returns a value, so I suspect the issue is with the rendering of the View in the App Extension. 2. Gestures are slow to register, or can't register at all. For example, if I place my DeviceActivityReport inside a ScrollView, I cannot scroll if I perform the gesture on the report view. If I try to scroll on the part of the screen th
3
0
2.0k
Mar ’23