Search results for

SwiftUI List performance

50,606 results found

Post

Replies

Boosts

Views

Activity

Reply to Hide separators in List (SwiftUI)
StackOverflow post - https://stackoverflow.com/questions/56489099/how-to-remove-row-separators-from-a-list-in-swiftui suggested something super tacky, would rather not do this. SwiftUI team, please just give us a .listSeparatorStyle(.none) view modifier.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’20
Reply to SwiftUi strange behaviour (bugs?)
If I put more than ten subviews into VStack/HStack/ScrollView/List, I got error Extra argument in call, but there is no extra argument (actually, I get this error if I just add 11 Text(Hello, world!)) It is a know limitation of the current implementation of SwiftUI. The Swift language currently does not support variadic generic parameters. So, in the implementation @ViewBuilder, can only get 10 arguments. I get this error if I just add 11 Text(Hello, world!) That Text(Hello, world!) definitely is the extra argument. All the views declared in VStack/HStack/ScrollView/List... are passed to a hidden method, each view as an argument. If I put List into ScrollView, this list is not rendered (just empty space instead it), but there is no any error/warning/log messages (like for wrong constraints) This is another known issue. You can find some articles searching with swiftui list in scrollview. List hides when adding in ScrollView SwiftUI
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’21
Reply to ForEach creates Views twice
That's an old problem, as reported here: https://developer.apple.com/forums/thread/718281 That's caused by ForEach effectively, as no error here: var body: some View { // ForEach(1...1, id: .self) { i in subview(0) // } Some explanation here: it is due to the way SwiftUI performs init. https://www.reddit.com/r/SwiftUI/comments/166m0tn/double_initiation_in_foreach_loop/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’24
Array performance
When I run profiler and click on the extended detail icon ( icon with E in the circle ), it shows me the least performant area of my code for main thread. Turns out its Array's removeLast. Seems surprising. I would have expected this to be a non-event but its dragging my code down. Is there a higher performance way to remove the last element in a Swift Array? I wanted to avoid NSArray -- kind of a pain with Any and where. The swift documentation says removeLast should be O(1) and popLast is O(n). Is it copying the entire array to remove the last item? The array just contains class references.Before, I was doing some recursion in code that was ported from C++. But it appears that the recursion in Swift was slow. I suspected there might have been retains when I passed data to the recursive function. So, I made it iterative but I still needed a stack -- a swift Array. It was faster but now I've got this removeLast issue.Is NSArray and NSDictionary still more performant? I was using map
4
0
3.3k
Oct ’16
Metal Shader Performance
Hi, I have a customized ray marching algorithm code and I want to run it in a metal shader. btw I am not sure how I can get the maximum performance in the metal shader. can you let me know what is the best way to get maximum performance between below 1) and 2) approach? Use Computing Pipeline. make a kernel function for ray marching and link it into computing pipeline and display it as a image. Use Graphics Pipeline. run the algorithm inside of the fragment shader directly and link it into graphics pipeline and display it directly. Thanks,
0
0
409
Jul ’23
shouldrasterize performance question
Hello. I have a complex UIView with a lot of sublayers. To smooth my animation i make shouldrasterize = true before scaling on my ROOT layer.However I notice that performance is still poor when there are a lot of elements visible. And it becomes better if there are less sublayers on the screen at the moment.This strikes me as wrong. If the whole picture is a bitmap, not vector, then the performance should be the same no matter how much sublayers there are on the screen.What am I missing here? Is there a way to turn on shouldrasterize in such a way that the picture would scale fast no matter how many sublayers there are?Thank you.
0
0
690
May ’18
UIBlurEffect Performance
So I have several UIVisualEffectView's with UIBlurEffect:var blurView1 = UIVisualEffectView() blurView1 = UIVisualEffectView(effect: UIBlurEffect(style: .light)) self.view.addSubview(blurView1) var blurView2 = UIVisualEffectView() blurView2 = UIVisualEffectView(effect: UIBlurEffect(style: .light)) self.view.addSubview(blurView2)When I have several (>5) of these UIVisualEffectView's, I notice a significant drop in frames in graphics performance.So, I tried creating one common UIBlurEffect and reusing it for every UIVisualEffectView:let commonBlurEffect = UIBlurEffect(style: .light) var blurView1 = UIVisualEffectView() blurView1 = UIVisualEffectView(effect: commonBlurEffect) self.view.addSubview(blurView1) var blurView2 = UIVisualEffectView() blurView2 = UIVisualEffectView(effect: commonBlurEffect) elf.view.addSubview(blurView2)With above, I notice a slight improvement (may be not?), but still not acceptable.What are tricks and tips I can use to extract maximum performance out of UIVisualEffectView'
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
599
Feb ’17
Xcode 12.0 B2 SwiftUI - Bottom toolbar after List in ContentView no longer displays.
This code worked in Xcode 12.0 B1 but no longer works in B2. struct ContentView: View { var body: some View { NavigationView { List { ForEach (1..<10) { row in Text((row) - Test).foregroundColor(Color.white).fontWeight(.bold) } .listRowBackground(Color.burgundy) } .navigationTitle(Text(List Background Color Test)) .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .bottomBar) { HStack { Button(action: {}, label: { Text(One).foregroundColor(Color.white) }) Spacer() Button(action: {}, label: { Text(Two).foregroundColor(Color.white) }) Spacer() Button(action: {}, label: { Text(Three).foregroundColor(Color.white) }).foregroundColor(.blue) } } } } } }
3
0
2k
Jul ’20
SwiftUI viewWithTag
Is it possible to find a particular view in SwiftUI based on its tag ?When a row on a List is tapped, I want the textField on a row in another List to be updated.But the problem is I dont know how to get hold of the active textField or the index of the row in the other list.Please refer this image for clarity https://imgur.com/a/Ovv8IBY
1
0
1.1k
Jul ’19