A fast, safe, and efficient CBOR serialization library for Swift on any platform.
swiftpackageindex.com/thecoolwinter/CBOR/1.1.1/documentation/cbor
atproto
swift
cbor
1//
2// Person.swift
3// CBOR
4//
5// Created by Khan Winter on 10/20/25.
6//
7
8#if canImport(FoundationEssentials)
9import FoundationEssentials
10#else
11import Foundation
12#endif
13
14struct Person: Codable {
15 let name: String
16 let age: Int
17 let email: String
18 let isActive: Bool
19 let tags: [String]
20
21 static let mock = Person(
22 name: "Alice",
23 age: 30,
24 email: "alice@example.com",
25 isActive: true,
26 tags: ["swift", "cbor", "benchmark"]
27 )
28}
29
30struct Company: Codable {
31 let name: String
32 let founded: Int
33 let employees: [Person]
34 let metadata: [String: String]
35
36 static let mock = Company(
37 name: "Acme Corp",
38 founded: 1999,
39 employees: Array(repeating: Person.mock, count: 10),
40 metadata: ["industry": "tech", "location": "remote"]
41 )
42}