CPChatGroup

@objc
public class CPChatGroup : NSObject

This class is used to manage a chat group.

  • Server assigned unique identity for this group

    Declaration

    Swift

    @objc
    public private(set) var groupID: String? { get }
  • User-friendly name of the group

    Declaration

    Swift

    @objc
    public let name: String!
  • Group type is “open” or “closed”. Closed groups require invitation to join.

    Declaration

    Swift

    @objc
    public let type: String!
  • A URL pointing to a image to be used for the group

    Declaration

    Swift

    @objc
    public var image: URL?
  • The topic of discussion for the group

    Declaration

    Swift

    @objc
    public var subject: String?
  • The members of the chat group

    Declaration

    Swift

    @objc
    public var participants: Set<CPChatGroupParticipant>
  • This variable represents the status of the self participant of this chat group.

    Declaration

    Swift

    @objc
    public var status: CPChatParticipantStatus { get }
  • Returns true if current user is admin of this group conversation.

    @return true if current user is admin of this group conversation, false otherwise

    Declaration

    Swift

    @objc
    public var isAdmin: Bool { get }
  • This method is used to add a participant to this chat group.

    Declaration

    Swift

    @objc
    public func add(participant: CPChatGroupParticipant, completion: @escaping ErrorCompletionBlock)

    Parameters

    participant

    The participant to add to this chat group.

    completion

    The code block to execute upon completion of adding the chat group participant.

  • This method is used to remove a participant from this chat group.

    Declaration

    Swift

    @objc
    public func remove(participant: CPChatGroupParticipant, completion: @escaping ErrorCompletionBlock)

    Parameters

    participant

    The participant to remove from this chat group.

    completion

    The code block to execute upon completion of adding the chat group participant.

  • This method is used to accept the invitation to join this chat group.

    Declaration

    Swift

    @objc
    public func accept(completion: @escaping ErrorCompletionBlock)

    Parameters

    completion

    The code block to execute upon completion of accepting the invitation to the chat group.

  • This method is used to decline the invitation to this chat group.

    Declaration

    Swift

    @objc
    public func decline(completion: @escaping ErrorCompletionBlock)

    Parameters

    completion

    The code block to execute upon completion of declining the invitation to the chat group.

  • This method is used by a member to leave this chat group. A group owner cannot leave the chat group and should consider deleting the chat group instead.

    Declaration

    Swift

    @objc
    public func leave(completion: @escaping ErrorCompletionBlock)

    Parameters

    completion

    The code block to execute upon completion of leaving the chat group.

  • This method is used to update this chat group with new or modified participant information. If an user status changes to Disconnected, that member will be removed from the chat group.

    Declaration

    Swift

    @objc
    public func updateWith(participant: CPChatGroupParticipant)

    Parameters

    participant

    The participant to update within this chat group.