Home > OS >  SwiftUI - Implement dynamic row with changable icon and text hide/unhide in scrollView List
SwiftUI - Implement dynamic row with changable icon and text hide/unhide in scrollView List

Time:06-09

Im trying to implement swiftUI list item with different type of image, text, and icon in the list.

I can simply create static list and use List modifiers to list out all items in the view. But, I want behavior to be different here. In other words, row will be fully dynamic. I can modify row size or hide/unhide text or change icon based on dynamic condition.

I thought to implement by using Hstack and Vstack but it become cumbersome when we have 50 rows in single scroll view list. Is there any way to dynamic create row and change row content based on conditions ?

Thanks

CodePudding user response:

Yes you can create an enum using that enum you can set the conditions in row to achieve the dynamic row.

CodePudding user response:

Should use ScrollView or TabView instead of simply putting everything in a HStack or VStack. And to make things dynamic check out property wrappers especially State and Binding.

  • Related