Skip to content

TextReceivedEvent

Kenan Genjac edited this page Oct 23, 2023 · 2 revisions



text

Description

Read-only property that represents the content of the text.

Returns

  • String - Represents the textual content of the text for which the event has been received.

Example

func onTextReceived(_ textReceivedEvent: TextReceivedEvent) {
    os_log("The received text is %@.", textReceivedEvent.text)
}



from

Description

Read-only property that represents the sender's endpoint.

Returns

  • Endpoint - Represents the endpoint from which the received text was sent.

Example

func onTextReceived(_ textReceivedEvent: TextReceivedEvent) {
    os_log("The text has been sent by %@.", textReceivedEvent.from.identifier())
}



isDirect

Description

Read-only property that represents the isDirect status of the text.

Returns

  • Bool - Represents whether the received text has been sent directly to its recipient.

Example

func onTextReceived(_ textReceivedEvent: TextReceivedEvent) {
  if (textReceivedEvent.isDirect) {
    os_log("The received text has been sent directly.")
  } 
}



date

Description

Read-only property that represents the date when the text was received.

Returns

  • Date - Represents the date and time when the text was received.

Example

func onTextReceived(_ textReceivedEvent: TextReceivedEvent) {
    os_log("The time of receiving the text is %@.", textReceivedEvent.date)
}

Tutorials

Migration guides

Reference documentation

Clone this wiki locally