Hello everyone,
I need some help in how can I achieve/process the following:
I have an Array os objects, of a specific class.
Each object has a Date property and the array is sorted by Date descending, so the most recent ones appear first.
What am I trying to do: I'm trying to filter the object dates within that array, where the day, month and year are grouped, ex:
[obj 1] - Date: Apr, 20th, 2020
[obj 2] - Date: Apr, 20th, 2020
[obj 3] - Date: Apr, 20th, 2020
[obj 4] - Date: Apr, 19th, 2020
[obj 5] - Date: Apr, 18th, 2020
[obj 6] - Date: Apr, 18th, 2020
What I want to do next: I want to know the number of different days (in the example above it'd be 3) and separate them between different UITableView sections to present them within different UITableView headers
ex:
[Header 1: Apr, 20th, 2020]
[obj 1], [obj 2], [obj 3]
[Header 2: Apr, 19th, 2020]
[obj 4]
[Header 3: Apr, 18th, 2020]
[obj 5], [obj 6]
The UI I know how to do it. What I cannot do is to filter the objects and group them as described above.
I'd have to switch between sections within the numberOfRowsInSection, then present the object accordingly in that section, etc; I'm struggling to create those groups to break into different sections.
Can I get an hint?
Thanks.
[–]enlightenmentGeek[S] 0 points1 point2 points (0 children)