swiftui-list

SwiftUI NavigationLink in list

旧时模样 提交于 2021-02-11 04:33:29
问题 I tried to do a list which have image and a navigation link inside. In iOS 14.1 everything work fine but after I update my iOS to 14.2, something break. In the list while the user click the big image there will be a action sheet pop out, while the user click a systemImage it will trigger a navigation link. However, when I update to iOS 14.2, no matter what I clicked, it will trigger the NavigationLink. Can someone explain to me why will this happened and how to solve? Here is the sample code

SwiftUI NavigationLink in list

喜夏-厌秋 提交于 2021-02-11 04:32:07
问题 I tried to do a list which have image and a navigation link inside. In iOS 14.1 everything work fine but after I update my iOS to 14.2, something break. In the list while the user click the big image there will be a action sheet pop out, while the user click a systemImage it will trigger a navigation link. However, when I update to iOS 14.2, no matter what I clicked, it will trigger the NavigationLink. Can someone explain to me why will this happened and how to solve? Here is the sample code

SwiftUI NavigationLink in list

痞子三分冷 提交于 2021-02-11 04:30:15
问题 I tried to do a list which have image and a navigation link inside. In iOS 14.1 everything work fine but after I update my iOS to 14.2, something break. In the list while the user click the big image there will be a action sheet pop out, while the user click a systemImage it will trigger a navigation link. However, when I update to iOS 14.2, no matter what I clicked, it will trigger the NavigationLink. Can someone explain to me why will this happened and how to solve? Here is the sample code

SwiftUI - how to avoid row indenting in List when in Edit Mode, but not using onDelete? (code/video attached)

依然范特西╮ 提交于 2021-02-08 15:16:26
问题 In SwiftUI how can I avoid having row content being indenting in my List when I move into Edit Mode, but not using onDelete? That is currently my row content is indented as this happens, as if the "delete" button will be shown on the left, however I'm not using onDelete so there is no button there. Animated GIF Code extract here: var body: some View { VStack{ List() { ForEach(gcTasks) { gcTask in HStack { GCTaskRow(withGcTask: gcTask, haha: "") } } // .onDelete(perform: self.deleteTask) //

SwiftUI - how to avoid row indenting in List when in Edit Mode, but not using onDelete? (code/video attached)

自古美人都是妖i 提交于 2021-02-08 15:15:39
问题 In SwiftUI how can I avoid having row content being indenting in my List when I move into Edit Mode, but not using onDelete? That is currently my row content is indented as this happens, as if the "delete" button will be shown on the left, however I'm not using onDelete so there is no button there. Animated GIF Code extract here: var body: some View { VStack{ List() { ForEach(gcTasks) { gcTask in HStack { GCTaskRow(withGcTask: gcTask, haha: "") } } // .onDelete(perform: self.deleteTask) //

Performance Issue with SwiftUI List

时光总嘲笑我的痴心妄想 提交于 2021-02-08 11:34:32
问题 I have a List with displays the result of a dynamic FetchRequest. The code works fine, but having a bigger result set (e.g. 3000), the list is built quite slowly when the dynamic predicate changed. struct ItemList: View { @State var startsWith: String = "A" var body: some View { NavigationView { VStack { TextField("Startswith", text:$startsWith) FilterRequestList(filter: startsWith) } .navigationBarTitle("Tasks CD") } } } struct FilterRequestList: View { var fetchRequest: FetchRequest<Item>

Text in SwiftUI Form not wrapping after being changed

南笙酒味 提交于 2021-02-08 06:42:02
问题 I need to display some text in a SwiftUI Form that will change depending on the current state. However, if the "new" text is longer than the original string displayed when the form first appeared, it won't wrap correctly. In the example below, turning the toggle on changes the text being displayed, but it gets truncated instead of wrapping struct ContentView: View { @State var showLongString = false var body: some View { Form { Section { Text(showLongString ? "This is a string that is too

Text in SwiftUI Form not wrapping after being changed

放肆的年华 提交于 2021-02-08 06:40:54
问题 I need to display some text in a SwiftUI Form that will change depending on the current state. However, if the "new" text is longer than the original string displayed when the form first appeared, it won't wrap correctly. In the example below, turning the toggle on changes the text being displayed, but it gets truncated instead of wrapping struct ContentView: View { @State var showLongString = false var body: some View { Form { Section { Text(showLongString ? "This is a string that is too

Text in SwiftUI Form not wrapping after being changed

流过昼夜 提交于 2021-02-08 06:40:12
问题 I need to display some text in a SwiftUI Form that will change depending on the current state. However, if the "new" text is longer than the original string displayed when the form first appeared, it won't wrap correctly. In the example below, turning the toggle on changes the text being displayed, but it gets truncated instead of wrapping struct ContentView: View { @State var showLongString = false var body: some View { Form { Section { Text(showLongString ? "This is a string that is too

Longpress and list scrolling

别说谁变了你拦得住时间么 提交于 2021-02-07 02:46:16
问题 Using SwiftUI (latest XCode and testing on IOS 13.3) I'm trying to implement a long press gesture on items in a list, to allow user interaction with the individual items. The problem is that when I set "onLongPressGesture" anywhere in the list (on items, on the list itself), the list cannot be scrolled anymore. I can easily get a simple tap to work but a long press blocks scrolling. I've put together a small example that show this issue: struct ContentView: View { let data = [ "Test 1","Test