0

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

EN_Tech
  • 67
  • 6

2 Answers2

0

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

  • Please provide more details, add supporting code (if possible) and follow proper formatting guidelines: [Answer Guidelines](https://stackoverflow.com/help/how-to-answer) & [Formatting Guidelines](https://stackoverflow.com/editing-help) – N4SK Jun 09 '22 at 05:08
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 09 '22 at 05:08
  • Thanks for your solution. Im working on it – EN_Tech Jul 19 '22 at 19:35
0

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.

N4SK
  • 700
  • 8
  • 25