i have two arrays of custom objects([InboundMessages],[OutboundMessages])
struct InboundMessage {
let senderName: String!
let senderText: String!
let senderProfileImageName: String!
let timeAndDateMessageReceived: NSDate!
let hasBeenRead: Bool!
let messageUUID = NSUUID().UUIDString
let conversationUUID: NSUUID = NSUUID()
}
struct OutboundMessage {
var replyText: String!
var messageUUID = NSUUID().UUIDString
var timeAndDateMessageSent: NSDate!
var conversationUUID: NSUUID = NSUUID()
}
that are held with another custom object 'Conversation'
class Conversation {
var uUID: NSUUID!
var inboundMessages: [InboundMessage] = []
var outboundMessages:[OutboundMessage] = []
}
I'd like to display the conversation ordered by date within a tableview like a normal conversation would be but i cant get my head around how to do it after many attempts. I feel like it would be best to push them all into a sorted array and then let the tableview deal with it but im still not sure how to sort them and then how to put two different custom objects into the same array?
You may have guessed that im very new to swift and iOS so any help would be much appreciated.
Thanks