Here's an example code on how to Swift UI List an array in Swift:
main.swift345 chars18 lines
In the code above, an array of fruits
is defined and iterated over in the List
view. List
is a SwiftUI view that displays a scrollable list of data. In this example, we're using the id
parameter to uniquely identify each row in the list. Finally, we add a Text
view inside the closure to display each item from the array.
gistlibby LogSnag