Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Sources/Identity/Identity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,18 @@ extension Identifier: CustomStringConvertible {

extension Identifier: Equatable where Value.RawIdentifier: Equatable {}
extension Identifier: Hashable where Value.RawIdentifier: Hashable {}
extension Identifier: Sendable where Value.RawIdentifier: Sendable {}

// MARK: - Codable support

extension Identifier: Codable where Value.RawIdentifier: Codable {
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
rawValue = try container.decode(Value.RawIdentifier.self)
}
extension Identifier: Decodable where Value.RawIdentifier: Decodable {
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
rawValue = try container.decode(Value.RawIdentifier.self)
}
}

extension Identifier: Encodable where Value.RawIdentifier: Encodable {
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(rawValue)
Expand Down