When: Embedding a Image with a symbol effect in a stack view in SwiftUI, and putting this in a List Actual: The symbols animate when scrolling that item in and out of the view Expected: The symbol doesn't animate until the value changes. I have the following code which is boiled down from my actual code where the animating value is a @Model object property (other animations work fine when their animation's value is watching the same property.) I've boiled it down to the below examples: The top example works as expected (no symbol animations on scroll) The bottom example animates the symbols every time they scroll in to view #Preview { VStack { List { ForEach(1...100, id: .self) { index in Image(systemName: square.3.layers.3d) .symbolEffect(.bounce, value: index) } } List { ForEach(1...100, id: .self) { index in HStack { Image(systemName: square.3.layers.3d) .symbolEffect(.bounce, value: index) } } } } } This happens on Mac and iOS. I'm running Xcode 15.3 RC2 but it also hap
Search results for
SwiftUI List performance
50,605 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi everyone, I’m working on a screen that uses a single SwiftUI List composed of: a top block (statistics, month picker, year selector, total, Entrata/Uscita picker). a list of transactions grouped by day, each group inside its own Section. each row is a fully custom card with rounded corners (RoundedCornerShape) I’m correctly removing all separators using: .listRowSeparator(.hidden) .listSectionSeparator(.hidden) .scrollContentBackground(.hidden) .listStyle(.plain) Each row is rendered like this: TransazioneSwipeRowView(...) .listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) .listRowBackground(Color.clear) However, I still see thin horizontal lines appearing between: the search bar and the top block the top block and the start of the list between rows inside the grouped section sometimes at the bottom of a Section These lines are NOT: Divider() system separators backgrounds row borders They seem to be “ghost lines” automatically generated by SwiftUI’s
When you perform ondelete, you need to decrement playerEnterCount. func delete(at offsets: IndexSet) { pName.remove(atOffsets: offsets) playerEnterCount -= 1 } At the end of the List, you have an empty name. So, you could filter the list : List { ForEach(pName.filter() {$0 != }, id: .self) { aName in Text(aName) }.onDelete(perform: delete) }
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Hi, I'm using list for showing data in swift UI. While moving row app get crashed in mac app. Same code is working fine in iPad app.
If I use a TextField inside of a List, being able to actually focus on this text field is a nightmare. Sometimes, if you click just right, (seems to be single click and patiently wait), you will be able to actually focus and edit the text. Many times it just doesn't focus. Obviously, a user does not expect to fight a text field for focus. It should be clicked and immediately focused on. Not perhaps focused on in the next second or two if the system feels like it. What am I missing here? Does this just not work? This is reproducible in the simplest test case of literally just trying: @State var test = Blah List { TextField(foobar, text: $test) }
Hello, One of the features of AVKit you list is performance optimized. Could you confirm that you've made performance improvements in the last 12 months to AVKit? If so, could you share in what areas or what metrics improved? Thanks!
SwiftUI will not provide collection views or table views. Instead, you will use a List component to render lists of content.That said, you can of course wrap a UICollectionViewController in a SwiftUI View. However, going that route goes against the grain of what they are trying to accomplish with SwiftUI.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
I have a TabView in my app. One of the tabs contains a screen with a List view. No matter what content or .listStyle I try to apply, the List messes up the tab bar: The divider line disappears immediately and then, when the user goes to a different tab, depending on that content, it either restores/fixes the tab bar, so it looks normal again, or it remains messed up in a sense that only the currently active tab icon + label are visibly in the foreground. The blurred background of the tab bar and the other icons are either invisible or too far in the background, i.e. the content of the tab screen goes in front of the tab icons. The tab bar is expected to always be above the screen contents, even if the screen uses .ignoresSafeArea(). I also tried manually setting .zIndex(1) on various views. Everything worked perfectly fine with iOS 14.x, but since upgrading to iOS 15 this weird bug appeared. Example project: import SwiftUI import MapKit struct ContentView: View { var body: some View
My app is iOS 17 targeted and uses a card-based list view with Delete and Duplicate trailing and leading swipe actions. The Delete and Duplicate buttons display appropriately on iPad with rounded corners, height equal to card height and width expanding to fill the leading or trailing space created by the swipe action (with padding between the edge of the button and the edge of the card). See screenshot: However, on iPhone (a) the button heights extend from the top of the first card to the bottom of the last card in the scrolled list, (b) the width expands to completely fill the space without padding between the button and the cards, and (c) only the leading (or trailing) top and bottom corners are rounded (respectively). See screenshots: The swipe action modifiers are standard and applied on a CardView in the following view chain (NavigationSplitView -> ZStack -> Group -> ZStack -> List -> ForEach -> ZStack -> CardView | NavigationLink with empty view as workaro
Issue Description Whenever the first item in the List is a DisclosureGroup, all subsequent disclosure groups work fine. However, if the first item is not a disclosure group, the disclosure groups in subsequent items do not render correctly. This issue does not occur in macOS 15, where everything works as expected. Has anyone else encountered this behavior, or does anyone have a workaround for macOS 13 & 14? I’m not using OutlineGroup because I need to bind to an isExpanded property for each row in the list. Reproduction Steps I’ve created a small test project to illustrate the issue: Press “Insert item at top” to add a non-disclosure item at the start of the list. Then, press “Append item with sub-item” to add a disclosure group further down. The disclosure group does not display correctly. The label of the disclosure group renders fine, but the content of the disclosure group does not display at all. Press Insert item at top with sub-item and the list displays as expec
I'm experiencing an issue where my List selection (using EditButton) gets cleared when a confirmationDialog is presented, making it impossible to delete the selected items. Environment: Xcode 16.0.1 Swift 5 iOS 18 (targeting iOS 17+) Issue Description: When I select items in a List using EditButton and tap a delete button that shows a confirmationDialog, the selection is cleared as soon as the dialog appears. This prevents me from accessing the selected items to delete them. Code: State variables: @State var itemsSelection = Set() @State private var showDeleteConfirmation = false List with selection: List(currentItems, id: .self, selection: $itemsSelection) { item in NavigationLink(value: item) { ItemListView(item: item) } } .navigationDestination(for: Item.self) { item in ItemViewDetail(item: item) } .toolbar { ToolbarItem(placement: .primaryAction) { EditButton() } } Delete button with confirmation: Button { if itemsSelection.count > 1 { showDeleteConfirmation = true }
This is a SwiftUI project ?Did you try to perform an option-clean build folder ?
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
[ { label: Hello Workspace, children: [ { label: Workspace A, children: [ { id: A.1, label: Data 1 }, { id: A.2, label: Data 2 }, { id: A.3, label: Data 3 } ] }, { label: Workspace B, children: [ { id: B.1, label: Data 1 }, { id: B.2, label: Data 2 }, { label: Entry 3, children: [ { id: B.3.1, label: Sub-Dat 1 } ] } ] } ] }, { label: 11 Cowork, children: [ { label: Workspace A, children: [ { id: 11.A.1, label: Data 1 }, { id: 11.A.2, label: Data 2 } ] } ] } ] struct TreeNode: Identifiable, Codable { var id: String let label: String var children: [TreeNode]? private enum CodingKeys: String, CodingKey { case id case label case children } init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.id = try container.decode(String.self, forKey: .label) self.label = try container.decode(String.self, forKey: .label) self.children = try container.decodeIfPresent([TreeNode].self, forKey: .children) } } import SwiftUI struct ChildrenView: View { @StateObject priva
I have a list (sourced from Core Data) where each row is tappable and it opens a sheet. I’m passing an Observable Object from the list to the view loaded within the Sheet/Modal. I struggled with this code when I wrote it during the early/buggy days of SwiftUI last June (2019) and eventually ended up storing an ID in the row's View, then doing a lookup at time of tap. This worked great in iOS13 (and continues to do so even in Xcode 12) and resolved issues I had been experiencing with sheets opening the first time but never again (or not being dismissible). With that said, this doesn't sound like the right way to go, partially confirmed by this not working in iOS 14. I can't seem to find a good example anywhere of how one is supposed to do this. List { ForEach (locationStore.locations) { location in LocationRow(location: location, showLocationDetailsModal: self.$showLocationDetailsModal, locationIDToShowDetails: self.$locationIDToShowDetails) } } .sheet(isPresented: self.$sho
I'm using ScrollView to display my course list, and each card in the list, named 'CourseCardView' as shown in the code. When I test it on both the simulator and a physical device, I notice that scrolling is not smooth and feels laggy. I'm not sure how to address this issue. Here is my code: // // CourseListView.swift // LexueSwiftUI // // Created by bobh on 2023/9/3. // import SwiftUI struct CourseCardView: View { let cardHeight: CGFloat = 150 let cardCornelRadius: CGFloat = 10 let cardHorizontalPadding: CGFloat = 10 @State var courseName = course name @State var courseCategory = category name @State var progress = 66 var body: some View { ZStack { Image(default_course_bg2) .resizable() .blur(radius: 5, opaque: true) .cornerRadius(cardCornelRadius) .padding(.horizontal, cardHorizontalPadding) .frame(height: cardHeight) Color.white .cornerRadius(cardCornelRadius) .padding(.horizontal, cardHorizontalPadding) .frame(height: cardHeight) .opacity(0.1) VStack(alignment: .leading, spacing: