Skip to content

Commit 55c36d8

Browse files
authored
Add Identifiable conformances to models (#3852)
1 parent 3cd1e8c commit 55c36d8

16 files changed

+24
-27
lines changed

Sources/StreamChat/Models/Attachments/ChatMessageAttachment.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct StreamAttachment<Payload> {
4040
/// A type representing a chat message attachment.
4141
/// `ChatMessageAttachment<Payload>` is an immutable snapshot of message attachment at the given time.
4242
@dynamicMemberLookup
43-
public struct ChatMessageAttachment<Payload> {
43+
public struct ChatMessageAttachment<Payload>: Identifiable {
4444
/// The attachment identifier.
4545
public let id: AttachmentId
4646

Sources/StreamChat/Models/Channel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ public struct ChatChannel: Sendable {
369369
}
370370
}
371371

372+
extension ChatChannel: Identifiable {
373+
public var id: String { cid.rawValue }
374+
}
375+
372376
extension ChatChannel {
373377
/// The type of the channel.
374378
public var type: ChannelType { cid.type }

Sources/StreamChat/Models/ChatMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
public typealias MessageId = String
1010

1111
/// A type representing a chat message. `ChatMessage` is an immutable snapshot of a chat message entity at the given time.
12-
public struct ChatMessage: Sendable {
12+
public struct ChatMessage: Identifiable, Sendable {
1313
/// A unique identifier of the message.
1414
public let id: MessageId
1515

Sources/StreamChat/Models/Device.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extension Data {
1313
}
1414

1515
/// An object representing a device which can receive push notifications.
16-
public struct Device: Codable, Equatable, Sendable {
16+
public struct Device: Codable, Equatable, Identifiable, Sendable {
1717
private enum CodingKeys: String, CodingKey {
1818
case id
1919
case createdAt = "created_at"

Sources/StreamChat/Models/DraftMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import Foundation
66

7-
public struct DraftMessage: Sendable {
7+
public struct DraftMessage: Sendable, Identifiable {
88
/// A unique identifier of the message.
99
public let id: MessageId
1010

Sources/StreamChat/Models/MessageReaction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import Foundation
66

77
/// A type representing a message reaction. `ChatMessageReaction` is an immutable snapshot
88
/// of a message reaction entity at the given time.
9-
public struct ChatMessageReaction: Hashable, Sendable {
9+
public struct ChatMessageReaction: Hashable, Identifiable, Sendable {
1010
/// The id of the reaction.
11-
let id: String
11+
public let id: String
1212

1313
/// The reaction type.
1414
public let type: MessageReactionType

Sources/StreamChat/Models/MessageReminder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Foundation
66

77
/// A type representing a message reminder.
8-
public struct MessageReminder: Sendable {
8+
public struct MessageReminder: Identifiable, Sendable {
99
/// A unique identifier of the reminder, based on the message ID.
1010
public let id: String
1111

Sources/StreamChat/Models/Poll.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Foundation
66

77
/// The model for a Poll.
8-
public struct Poll: Equatable, Sendable {
8+
public struct Poll: Equatable, Identifiable, Sendable {
99
/// A boolean indicating whether the poll allows answers/comments.
1010
public let allowAnswers: Bool
1111

Sources/StreamChat/Models/PollOption.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Foundation
66

77
/// The model for an option in a poll.
8-
public struct PollOption: Hashable, Equatable, Sendable {
8+
public struct PollOption: Hashable, Equatable, Identifiable, Sendable {
99
/// The unique identifier of the poll option.
1010
public let id: String
1111

Sources/StreamChat/Models/PollVote.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Foundation
66

77
/// A structure representing a vote in a poll.
8-
public struct PollVote: Hashable, Equatable, Sendable {
8+
public struct PollVote: Hashable, Equatable, Identifiable, Sendable {
99
/// The unique identifier of the poll vote.
1010
public let id: String
1111

0 commit comments

Comments
 (0)