Conversation
struct Conversation : Identifiable
A conversation is a thread of messages with some user that you have added.
Conversations have an unique id and holds all the messages in that conversation. This includes the messages that you have sent as well.
-
An unique identifier for the conversation
Declaration
Swift
var id: Int32
-
The author - or the username of the person who is not you.
Declaration
Swift
var author: String
-
The last message sent in the conversation. This includes yours and the authors last message.
Declaration
Swift
var lastMessage: LocalMessage
-
A list of all messages sent in the conversation.
Declaration
Swift
var messages: [LocalMessage]
-
Add a message to the end of a conversation thread.
Declaration
Swift
mutating func addMessage(add message: LocalMessage)
Parameters
message
The message to append to the array of messages.
-
Update the last message in the thread.
This is the message shown on the
ContentView
.Declaration
Swift
mutating func updateLastMessage(new message: LocalMessage)
Parameters
message
The message to set last message to.