/GroupSections

An easy way to group your Lists for different Sections in UITableView by Date.

Primary LanguageSwift

GroupSections

An easy way to group your Lists in different Sections in UITableView by Date. Just download the source code from files.

How to use

  1. Create a Item-Class which has GroupSections.ObjectRow as SuperClass.
class Person: GroupSections.ObjectRow {
	var id: Int
	var name: String
	
	init(id: Int, name: String) {
		self.id = id
		self.name = name
	}
}
  1. Create some objects of Person.
var persons = [Person]()
persons.append(id: 1, name: "Mike")
persons.append(id: 2: name: "Dave")
  1. Change in GroupSections-Class the parameter from group to your custom Person-Class.
static func group(_ persons: [Person], by component: Calendar.Component) -> [Object] { ... }
  1. Group your objects by calling group.
var groupedPersons: [GroupSections.Object] = GroupSections.group(persons, by: .month)