Is multiple actions not yet supported with swiftUI when swipe list items? This is really disappointed i can't find a way to implement this using swiftUI Need some advices folks i really do need to implement something Thank you in
Search results for
SwiftUI List performance
50,605 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
This question is inspired by this stackoverflow post : https://stackoverflow.com/questions/59895935/swiftui-form-and-stacknavigationviewstyle-run-berserk At present (Xcode 11.7) there seems to be a bug in Form, making a new copy of the view with every orientation change of the device. I can reproduce it on a iPhone 11 emulator with iOS 13.7. Sample code: import SwiftUI struct ContentView: View { ttvar body: some View { ttttttForm{ ttttttttText(Text) tttttt} tt} } Visual debugger at beginning, rotate left and then rotate right, shows an additional view added to the view stack with each new movement. A Form automatically adopts the GroupedListStyle and it seems that it’s actually there the bug is. Because a List with GroupedListStyle shows the same behavior in the visual debugger. import SwiftUI struct ContentView: View { ttvar body: some View { ttttList{ ttttttText(Text) tttt}.listStyle(GroupedListStyle()) tt} } So, any workaround or fix informations please?
In SwiftUI's List, on macOS, if I embed a TextField then the text field is presented as non-editable. If the user clicks on the text and waits a short period of time, the text field will become editable. I'm aware this is generally the correct behaviour for macOS. However, is there a way in SwiftUI to supress this behaviour such that the TextField is always presented as being editable? I want a scrollable, List of editable text fields, much like how a Form is presented. The reason I'm not using a Form is because I want List's support for reordering by drag-and-drop (.onMove). Use Case A view that allows a user to compose a questionnaire. They are able to add and remove questions (rows) and each question is editable. They require drag-and-drop support so that they can reorder the questions.
Hi there, I would like to implement a search bar into my existing list, filled with NavigationLinks. Is there a possibility to mark all my existing NavigationLinks with variables that I can show them in my search list? I am still quite new to SwiftUI so I would love to hear from you. Here is my code: var body: some View { NavigationView { List { Group { NavigationLink(destination: MidazolamLink()){ Image(MidazolamMediLabel) .resizable() .frame(width:60, height: 30) Text(Midazolam) } NavigationLink(destination: NaloxonLink()){ Image(NaloxonMediLabel) .resizable() .frame(width:60, height: 30) Text(Naloxon) } NavigationLink(destination: ParacetamolLink()){ Image(ParacetamolMediLabel) .resizable() .frame(width:60, height: 30) Text(Paracetamol) } NavigationLink(destination: PrednisolonLink()){ Image(PrednisolonMediLabel) .resizable() .frame(width:60, height: 30) Text(Prednisolon) } NavigationLink(destination: SalbutamolLink()){ Image(SalbutamolMediLabel) .resizable() .frame(widt
Hi all,I know this is may not be the right forum to post questions about Realm but my issue has to do with the nature of how SwiftUI works.Has anyone been able to successfully integrate Realm with SwiftUI, especially deleting records/rows from a SwiftUI List? I have tried a few different things but no matter what I do I get the same error. After reading some related threads I found out that other people have the same issue but I refuse to think that there is no current solution to integrate Realm with SwiftUI.The following code successfully presents all of the items from Realm in a SwiftUI List, I can create new ones and they show up in the List as expected, my issues is when I try to delete records from the List by either manually pressing a button or by left-swiping to delete the selected row, I get an Index is out of bounds error.Here is my code.Realm Model:class Dog: Object { @objc dynamic var name = @objc dynamic var age = 0 @objc d
Hi, I am running into a reproducible SwiftUI List crash when using @FetchRequest based on an @ObservedObject. The crash happens only when deleting the last item in a section. All other deletes and inserts (that I've tested so far) seem to work fine. I'm hoping I can figure out why this happens, and if there is a workaround that I can use. The crash looks something like this: *** Assertion failure in -[SwiftUI.UpdateCoalescingCollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:], UICollectionView.m:10643 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete item 17 from section 0 which only contains 17 items before the update' The setup: I have a Core Data one-to-many relationship ... in this case, a Contact that has many Notes saved to it. When you select a Contact from a list, it goes to a ContactDetailsView which has some details of the contact, and a list
Hi all, with the below code I get How can I hide the gray angles? Thank you for your help. NavigationView { ZStack { RoundedRectangle(cornerRadius: 10) .foregroundColor(Color(red: 0.283, green: 0.481, blue: 0.658)) .shadow(radius: 10) .overlay( RoundedRectangle(cornerRadius: 15) .stroke(Color(hue: 0.579, saturation: 0.0, brightness: 0.9), lineWidth: 2) ) List ( driversArr, id:.self, selection: $selection) { currentDriver in NavigationLink { RiskDriverDetailsView(theDriver: currentDriver) } label: { Label(currentDriver.wrappedName, systemImage: point.filled.topleft.down.curvedto.point.bottomright.up) } .foregroundColor(.white) } .scrollContentBackground(.hidden) } .background(Color(.clear)) }
Hi! I want to allow user to scroll a long list of items iOS app, so I am trying to embbed a List view in ScrollView view. However, the preview result doesn't work. Can you help me to check what I am missing?Below is my experimental code I entered to the file ContentView.swift, started with Single Page App project.struct ContentView: View { var body: some View { ScrollView{ List{ Text(abc) Text(def) } .border(Color.yellow, width: 3) .background(Color.blue) }.padding(10).border(Color.red, width: 3) } }The preview of this code shows the red borders of the ScrollView, but not showing anything for the list, nor the text inside. If I change List to VStack, then everything worked as expected.I don't understand why List doesn't work, and don't know how to fix it. Can you help me to find some clue?Thank you!
Is there ant wat to use UITableViewStyleInsetGrouped style in #swiftui List.listStyle() ?
I have a simple app in SwiftUI, and I try to delete all list items with context menu , when I click context menu button, I want to remove all items, is it possible? struct MyView: View { @State private var selectedUsers: MyModel? var body: some View { ScrollView(.vertical, showsIndicators: false, content: { VStack(content: { ForEach(datas){ data in MyRowView(data: data) .contextMenu { Button(action: { self.delete(item: data) }) { Text(delete) } } .onTapGesture { selectedUsers = data } } .onDelete { (indexSet) in selectedUsers.remove(atOffsets: indexSet) }}) })} private func delete(item data: MyModel) { if let index = datas.firstIndex(where: { $0.id == data.id }) { datas.remove(at: index) } }} model: struct MyModel: Identifiable, Hashable, Codable { var id = UUID().uuidString var name: String } var datas = [ MyModel(name: david), MyModel(name: marry), ]
Hi everyone! I'm currently struggling with dynamically filtering data in a SwiftUi List view. In the following example, I created some example data and stored them within TestArray. These data is dynamically filtered and grouped by the starting letter. The data of the Testclass objects can be changed in EditDetails view. Unfortunately, when changing the name (as it is the relevant property for filtering here), when closing the modal, the user does not return to DetailView but will break the view hierarchy and end up in the ContentView. I assume the issue is the update within ContentView, which is recreating the DetailView stack. Is it possible to ensure the return to view, where the modal has been opened from (DetailView)? Here is some code if you would like to reproduce the issue: import Foundation import SwiftUI import Combine struct ContentView: View { @StateObject var objects = TestArray() var body: some View { NavigationView{ List { ForEach(objects.objectList.compactMa
I would like to do a NavigationLink from List to a Detail- View (change the Stock-Datails). I know how to do the NavigationLink but not how to hand over the detail-Record of the list. List sample - https://developer.apple.com/forums/content/attachment/b29fa9f2-7243-41f2-b75f-8961c9b79c44 I would appriciate to see a sample. Those e.g. of Landmarks do not have Core-Date. Thank you in advance
I have a SwiftUI List pushed through NavigationLink. But when I scroll down the data suddenly turn empty. Not sure why? Xcode 14.2 Here's my implementation Parent View (doesn't has issue) NavigationView { List { ForEach(viewModel.endorsements, id: .name) { endorsement in EndorsementListItem(endorsement: endorsement) .background { NavigationLink { viewModel.buildEndorsmentListDetail(endorsement) } label: { EmptyView() }.opacity(0) } .padding(.vertical, 16) .listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) } } .padding(.horizontal, 12) .listStyle(.plain) ... Child View (which has the issue) struct EndorsementListDetail: View { var body: some View { List { ForEach(viewModel.endorsement.details) { detail in VStack(spacing: 8) { EndorsementListDetailItem(detail: detail) Divider() } .listRowSeparator(.hidden) .listRowInsets(EdgeInsets(top: 8, leading: 12, bottom: 0, trailing: 12)) } } .listStyle(.plain) ... } When I scroll down, the list turn empty A
https://developer.apple.com/tutorials/swiftui/working-with-ui-controls Button action in List causes event bubbling error. I tried fix it: https://github.com/rushairer/MySwiftApp/commit/8d9578f07a4e55d061f779f44bf20d113f642bd5 Using 'onTapGesture' instead of Button
In one of my applications I use several List views with Sections. After upgrading to Sequoia I faced the issue, that after selecting an item, the List suddenly scrolls to a different position. Sometimes the selection even gets out of the view, but in every case a double click just went to the wrong item. At one list I found out, that the issue could be solved after changing the data source. I used a computed property, what seems to be a stupid idea. After changing this it now works. Unfortunately there is another List, where this didn't bring the solution. And unfortunately, I cannot reproduce the issue in a code example. One guess of mine is, that it could be related to the fact, that the rows have different heights (because in some are two lines of text and in some are three). And it seems to happen only in very long lists. It worked perfectly in Sonoma. Does anyone face the same issue?
Topic:
UI Frameworks
SubTopic:
SwiftUI