CodableRepresentation
A transfer representation for types that participate in Swift’s protocols for encoding and decoding.
Declaration
@preconcurrency struct CodableRepresentation<Item, Encoder, Decoder> where Item : Transferable, Item : Decodable, Item : Encodable, Encoder : TopLevelEncoder, Encoder : Sendable, Decoder : TopLevelDecoder, Decoder : Sendable, Encoder.Output == Data, Decoder.Input == DataMentioned in
Overview
struct Todo: Codable, Transferable {
var text: String
var isDone = false
static var transferRepresentation: some TransferRepresentation {
CodableRepresentation(contentType: .todo)
}
}
extension UTType {
static let todo = UTType(exportedAs: "com.example.todo")
}