Skip to content
Snippets Groups Projects
Commit bd34e3c0 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add MessagePayload model

parent 42ff53fd
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!87Messenger example - chat
import Foundation
public struct MessagePayload: Equatable {
public init(text: String) {
self.text = text
}
public var text: String
}
extension MessagePayload: Codable {
enum CodingKeys: String, CodingKey {
case text
}
public static func decode(_ data: Data) throws -> Self {
try JSONDecoder().decode(Self.self, from: data)
}
public func encode() throws -> Data {
try JSONEncoder().encode(self)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment