Apple Developer Documentation

The CaseIterable protocol provides a property named allCases that you can use to iterate through the cases of the conforming enumeration.

Which protocol has a property that you can use to iterate through all cases of an enumeration?

enum ReminderRow: Int, CaseIterable {
        case title
        case date
        case time
        case notes
}

return ReminderRow.allCases.count //4

enum

enum과 switch를 사용해서 적절한 데이터(이미지, string 등)를 뽑아내기

enum ReminderRow: Int, CaseIterable {
        case title
        case date
        case time
        case notes
        
        // MARK: - This method returns the appropriate text to display based on the current enumeration case.
        func displayText(for reminder: Reminder?) -> String? {
            switch self {
            case .title:
                return reminder?.title
            case .date:
                return reminder?.dueDate.description
            case .time:
                return reminder?.dueDate.description
            case .notes:
                return reminder?.notes
            }
        }
        // MARK: - This method returns the appropriate image to display based on the current enumeration case.
        var cellImage: UIImage? {
            switch self {
            case .title:
                return nil
            case .date:
                return UIImage(systemName: "calendar.circle")
            case .time:
                return UIImage(systemName: "clock")
            case .notes:
                return UIImage(systemName: "square.and.pencil")
            }
        }
    }