HomeiOS Developmentios - Utilizing grouped knowledge

ios – Utilizing grouped knowledge


As an instance I’ve used the next code:

let groupedMessages = Dictionary(grouping: Messages, by: { $0.date })

to group my messages by their date, in order that once I print(groupedMessages) I get the next:

[
  "01-01-2023": [
    Messages(text: "hello", date: "01-01-2023"),
    Messages(text: "hey", date: "01-01-2023"),
    Messages(text: "how are you?", date: "01-01-2023"),
    Messages(text: "good thanks, yourself", date: "01-01-2023")
  ],
  "02-01-2023": [
    Messages(text: "good thank you", date: "02-01-2023"),
    Messages(text: "bye", date: "02-01-2023"),
]

How would I then really show these messages of their new grouped order on a view so that every message seems so as beneath the date they have been despatched on?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments