У меня есть данные в виде
Array<(key: String, value: Array<Chat>)>
Я хочу преобразовать их в
Dictionary<String, Array<Chat>>
, где Chat - это массив.
Вот мои данные : -
[(key: "2020-01-27", value: [Unilife.Chat(id: Optional(840), roomID: Optional("5010682260"), message: Optional("Hello"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-27 10:09:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-27"), createdAt: Optional("2020-01-27T10:09:31.000Z"), updatedAt: Optional("2020-01-27T10:09:44.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(841), roomID: Optional("5010682260"), message: Optional("Kjjhhbbb"), thumb: nil, filepath: nil, senderID: Optional(777), receiverID: Optional(658), groupID: nil, chatID: nil, date: Optional("2020-01-27 10:09:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-27"), createdAt: Optional("2020-01-27T10:09:44.000Z"), updatedAt: Optional("2020-01-27T11:02:07.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0)]), (key: "2020-01-28", value: [Unilife.Chat(id: Optional(842), roomID: Optional("5010682260"), message: Optional("Unilife158029258648577759581565958156.m4a"), thumb: Optional(""), filepath: Optional(""), senderID: Optional(777), receiverID: Optional(658), groupID: nil, chatID: nil, date: Optional("2020-01-28 10:09:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("audio"), onlyDate: Optional("2020-01-28"), createdAt: Optional("2020-01-28T10:09:49.000Z"), updatedAt: Optional("2020-01-28T11:02:07.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(843), roomID: Optional("5010682260"), message: Optional("Hee"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-28 11:02:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-28"), createdAt: Optional("2020-01-28T11:02:07.000Z"), updatedAt: Optional("2020-01-28T11:22:21.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0)]), (key: "2020-01-29", value: [Unilife.Chat(id: Optional(844), roomID: Optional("5010682260"), message: Optional("Dasdasd"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-29 12:10:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-29"), createdAt: Optional("2020-01-29T12:10:32.000Z"), updatedAt: Optional("2020-01-29T12:10:43.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(848), roomID: Optional("5010682260"), message: Optional("Hgchchc"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-29 12:11:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-29"), createdAt: Optional("2020-01-29T12:11:34.000Z"), updatedAt: Optional("2020-01-29T12:11:38.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(849), roomID: Optional("5010682260"), message: Optional("Jjjhvjhv"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-29 12:11:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-29"), createdAt: Optional("2020-01-29T12:11:45.000Z"), updatedAt: Optional("2020-01-29T12:12:18.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(850), roomID: Optional("5010682260"), message: Optional("Rr"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-29 12:11:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-29"), createdAt: Optional("2020-01-29T12:11:50.000Z"), updatedAt: Optional("2020-01-29T12:12:18.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(851), roomID: Optional("5010682260"), message: Optional("Hello"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-29 12:12:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-29"), createdAt: Optional("2020-01-29T12:12:14.000Z"), updatedAt: Optional("2020-01-29T12:12:18.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(852), roomID: Optional("5010682260"), message: Optional("H"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-29 12:28:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-29"), createdAt: Optional("2020-01-29T12:28:39.000Z"), updatedAt: Optional("2020-01-29T12:30:32.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0)]), (key: "2020-01-30", value: [Unilife.Chat(id: Optional(853), roomID: Optional("5010682260"), message: Optional("Jhffjh"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-30 12:28:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-30"), createdAt: Optional("2020-01-30T12:28:45.000Z"), updatedAt: Optional("2020-01-30T12:30:32.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0), Unilife.Chat(id: Optional(855), roomID: Optional("5010682260"), message: Optional("Svsvvsvs"), thumb: nil, filepath: nil, senderID: Optional(658), receiverID: Optional(777), groupID: nil, chatID: nil, date: Optional("2020-01-30 12:49:00"), seen: Optional("1"), isDeleted: Optional("00"), deleteChatID: Optional("0"), messageType: Optional("text"), onlyDate: Optional("2020-01-30"), createdAt: Optional("2020-01-30T12:49:42.000Z"), updatedAt: Optional("2020-01-30T12:50:11.000Z"), senderUserChat: nil, chatSlide: nil, isPlaying: false, currentDuration: 0.0)])]