swiftui-list

SWiftUI anchorPreference inside List

妖精的绣舞 提交于 2021-01-04 06:01:28
问题 I'm using anchorPreferences to set the height of GeometryReader to fit the height of its content. The issue I'm experiencing is, after scrolling up and down the List a few times, the app freezes, the design gets messy, and I get the following message in the console: Bound preference CGFloatPreferenceKey tried to update multiple times per frame. Any ideas how I can fix this? IMPORTANT NOTE: I've simplified my design as much as I could. Here is the code: struct ListAndPreferences: View { var

SWiftUI anchorPreference inside List

馋奶兔 提交于 2021-01-04 06:00:29
问题 I'm using anchorPreferences to set the height of GeometryReader to fit the height of its content. The issue I'm experiencing is, after scrolling up and down the List a few times, the app freezes, the design gets messy, and I get the following message in the console: Bound preference CGFloatPreferenceKey tried to update multiple times per frame. Any ideas how I can fix this? IMPORTANT NOTE: I've simplified my design as much as I could. Here is the code: struct ListAndPreferences: View { var

SwiftUI: Updating an array item does not update the child UI immediately

て烟熏妆下的殇ゞ 提交于 2021-01-01 04:24:29
问题 I have an array of items (numbers) to be presented to the user using NavigationView, List and a leaf page. When I update an item (numbers[index] = ...) on a leaf page, it updates the list correctly (which I see when I go back to the list), but not the leaf page itself immediately. I see the change if I go back to the list and re-open the same leaf page. I would like to understand why it does not update the UI immediately, and how to fix it. Here is the simplified code to re-produce this

SwiftUI: Updating an array item does not update the child UI immediately

被刻印的时光 ゝ 提交于 2021-01-01 04:23:40
问题 I have an array of items (numbers) to be presented to the user using NavigationView, List and a leaf page. When I update an item (numbers[index] = ...) on a leaf page, it updates the list correctly (which I see when I go back to the list), but not the leaf page itself immediately. I see the change if I go back to the list and re-open the same leaf page. I would like to understand why it does not update the UI immediately, and how to fix it. Here is the simplified code to re-produce this

SwiftUI: Updating an array item does not update the child UI immediately

╄→尐↘猪︶ㄣ 提交于 2021-01-01 04:21:49
问题 I have an array of items (numbers) to be presented to the user using NavigationView, List and a leaf page. When I update an item (numbers[index] = ...) on a leaf page, it updates the list correctly (which I see when I go back to the list), but not the leaf page itself immediately. I see the change if I go back to the list and re-open the same leaf page. I would like to understand why it does not update the UI immediately, and how to fix it. Here is the simplified code to re-produce this

SwiftUI List inside ScrollVIew

删除回忆录丶 提交于 2020-12-30 05:57:23
问题 I want to make my List inside a ScrollView so that I can scroll List rows and headers together. But I found that List inside ScrollView isn't working. It shows nothing. Anyone know why this happens and(or) how to fix? I should use both of them. I should use ScrollView so that I can make my header(image or text) also scrolled when I scroll the rows. I should use List to use .ondelete() method. my sample code is below. @State private var numbers = [1,2,3,4,5,6,7,8,9] var body: some View {

SwiftUI disable list border iOS 14 [duplicate]

一笑奈何 提交于 2020-12-26 08:20:23
问题 This question already has an answer here : SwiftUI iOS14 - NavigationView + List - Won't fill space (1 answer) Closed 3 months ago . I found the list in SwiftUI iOS 14 will have something like border if the view contained navigationView. Is there any solution to disable the border? Coz the border break the design of my application. Here is the code that contained no NavigationView inside the code. struct ContentView: View { @State var isPresent = false var body: some View { let first =

SwiftUI disable list border iOS 14 [duplicate]

匆匆过客 提交于 2020-12-26 08:20:03
问题 This question already has an answer here : SwiftUI iOS14 - NavigationView + List - Won't fill space (1 answer) Closed 3 months ago . I found the list in SwiftUI iOS 14 will have something like border if the view contained navigationView. Is there any solution to disable the border? Coz the border break the design of my application. Here is the code that contained no NavigationView inside the code. struct ContentView: View { @State var isPresent = false var body: some View { let first =

SwiftUI disable list border iOS 14 [duplicate]

折月煮酒 提交于 2020-12-26 08:19:25
问题 This question already has an answer here : SwiftUI iOS14 - NavigationView + List - Won't fill space (1 answer) Closed 3 months ago . I found the list in SwiftUI iOS 14 will have something like border if the view contained navigationView. Is there any solution to disable the border? Coz the border break the design of my application. Here is the code that contained no NavigationView inside the code. struct ContentView: View { @State var isPresent = false var body: some View { let first =

List inside ScrollView is not displayed on WatchOs

非 Y 不嫁゛ 提交于 2020-12-13 05:03:10
问题 I have a list inside a scrollview and it is not displaying below the image and the buttons. I've also tried to put the list and other items inside of a VStack and that allows me to see one item of the list at the time opposed to scrolling past the Image and buttons to show the whole list. ScrollView{ Image(uiImage: self.image) .resizable() .frame(width: 80, height: 80) .scaledToFit() Text("\(name)") .lineLimit(2) HStack{ Button(action: { print("button1") }){ Image(systemName: "pencil") }