skip to Main Content

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

2

Answers


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

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search