Dynamic List and Identifiable in SwiftUI

Yasir
2 min readJun 29, 2020

How you can make dynamic list in your iPhone app | ios | swiftUI |Identifiable |UUID()

A list in SwiftUI is almost similar to tableView , if you want to make it dynamically so that you don’t want to write every item of the list in your list view , you can create an array of your list items and you can fetch them by identifying . Now to get every item from array to the list , you must create your data as identifiable .

To understand it more clearly , go through the below code :

In line 26 you can see we have created a structure of type identifiable and inside it a variable as id of UUID . UUID provides a unique id to every properties . In line 31 we are creating array of post and initialising our element .

In list we are kind of fetching our elements from array posts and showing them in our list .

This is how our app will look like :

--

--

Yasir

Exploring the Swift, SwiftUI, and Apple universe.