List

#list

Overview

Subjects

Form vs List

  • Form is for User Input

  • List is for Presentation of data

Edge to Edge Color

Edge to edge color
.listStyle(.plain)

List with row number

Let list =["Car", "Bike", "Plane", "Boat"]
for(index, element) inlist.enumerated() {    
print(index, ":", element)}

// print: 0 : Car1 : Bike2 : Plane3 : Boat

List with Sections

Sorted List

The result is the same on both methods. The benefit is, in case of using this list everywhere with same sorting method, we can change the sorting method in the struct and it changes everywhere we use the list.

Result
Hacking with Swift / 100 Days / Day-68 - Adding conformance to Comparable for custom types

Swipe Actions

Hacking with Swift / 100 Days / Day-81 - Adding custom row swipe actions to a List

Other sources

Adding options with Swipe Actions

Hacking with Swift / 100 Days / Day-83 - Adding options with swipe actions

Sorting the List

Define the alternatives

Convert enum type to variable and Publish it

Sources

Videos

Articles / Documents

Last updated

Was this helpful?