There is one class inherited Object that includes one Date-type property.
class Entry: Object {
let date: Date = Date()
}
And there is a list of Entry objects.
let entries: List<Entry>
EntryA (date: 2020-09-01 02:00 am)
EntryB (date: 2020-09-01 03:10 pm)
EntryC (date: 2020-09-02 03:40 am)
EntryD (date: 2020-09-02 05:23 am)
EntryE (date: 2020-09-02 08:42 pm)
EntryF (date: 2020-09-03 11:04 am)
EntryG (date: 2020-09-03 13:42 pm)
I’d like to divide this list into two groups: “am” and “pm”.
The am group describes entries that have a date property between 12:00 am - 11:59 am.
The pm group describes entries that have a date property between 12:00 pm - 11:59 pm.
am Group:
EntryA (date: 2020-09-01 02:00 am)
EntryC (date: 2020-09-02 03:40 am)
EntryD (date: 2020-09-02 05:23 am)
EntryF (date: 2020-09-03 11:04 am)
pm Group:
EntryB (date: 2020-09-01 03:10 pm)
EntryE (date: 2020-09-02 08:42 pm)
EntryG (date: 2020-09-03 13:42 pm)
How can I filter the entries from the list into the am and pm groups (as shown above)?