Room

public final class Room : Identifiable, ObservableObject, OrangeChatLoggable
extension Room: Equatable

An object representing a room.

Instances are created by using the RoomList.room(with:and:) method.

Stored Properties

  • id

    The identifier of this room.

    Declaration

    Swift

    @Published
    public var id: OrangeChatKey { get set }
  • The last time date this room was updated.

    Declaration

    Swift

    @Published
    public var lastUpdateDate: Date { get set }
  • The last message sent in this room.

    Declaration

    Swift

    @Published
    public var lastMessage: String? { get set }
  • The name of this room.

    Declaration

    Swift

    @Published
    public var name: String { get set }
  • The messages exchanged in this room.

    Declaration

    Swift

    @Published
    public var messages: [Message] { get set }
  • The participants who are typing.

    Declaration

    Swift

    @Published
    public var typingParticipants: [OrangeChatKey : String] { get set }

API

  • Send a text message in this room.

    Declaration

    Swift

    public func send(_ text: String, image: UIImage? = nil, thumbImage: UIImage? = nil) -> OrangeChatPublisher<Void>

    Parameters

    message

    The text message to be sent.

    Return Value

    A publisher with a Void value.

  • Update the presence of the current user of the room.

    The presence of the current user need to be updated each time he or she enters and exits the room.

    Declaration

    Swift

    public func update(presence: Presence) -> OrangeChatPublisher<Void>

    Parameters

    presence

    The presence of the curent user of the room.

    Return Value

    A publisher with a Void value.

  • Indicates to other users in the room if the current user is typing.

    Declaration

    Swift

    public func user(isTyping: Bool) -> OrangeChatPublisher<Void>

    Parameters

    isTyping

    A boolean defining whether the current user is typing.

    Return Value

    A publisher with a Void value.

Equatable

  • Declaration

    Swift

    public static func == (lhs: Room, rhs: Room) -> Bool