Skip to content

Commit

Permalink
Make JSON protocols Sendable
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Jan 2, 2025
1 parent 29ea986 commit f0b8d92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions Sources/WalletOrders/OrderJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public enum OrderJSON {
/// A protocol that defines the structure of a `order.json` file.
///
/// > Tip: See the [`Order`](https://developer.apple.com/documentation/walletorders/order) object to understand the keys.
public protocol Properties: Codable {
public protocol Properties: Codable, Sendable {
/// The date and time when the customer created the order, in RFC 3339 format.
var createdAt: String { get }

Expand Down Expand Up @@ -48,7 +48,7 @@ extension OrderJSON {
/// A protocol that represents the merchant associated with the order.
///
/// > Tip: See the [`Order.Merchant`](https://developer.apple.com/documentation/walletorders/merchant) object to understand the keys.
public protocol Merchant: Codable {
public protocol Merchant: Codable, Sendable {
/// The localized display name of the merchant.
var displayName: String { get }

Expand All @@ -64,7 +64,7 @@ extension OrderJSON {
/// A protocol that represents the details of a barcode for an order.
///
/// > Tip: See the [`Order.Barcode`](https://developer.apple.com/documentation/walletorders/barcode) object to understand the keys.
public protocol Barcode: Codable {
public protocol Barcode: Codable, Sendable {
/// The format of the barcode.
var format: BarcodeFormat { get }

Expand All @@ -80,24 +80,24 @@ extension OrderJSON {

extension OrderJSON {
/// The type of order this bundle represents.
public enum OrderType: String, Codable {
public enum OrderType: String, Codable, Sendable {
case ecommerce
}

/// A high-level status of the order, used for display purposes.
public enum OrderStatus: String, Codable {
public enum OrderStatus: String, Codable, Sendable {
case completed
case cancelled
case open
}

/// The version of the schema used for the order.
public enum SchemaVersion: Int, Codable {
public enum SchemaVersion: Int, Codable, Sendable {
case v1 = 1
}

/// The format of the barcode.
public enum BarcodeFormat: String, Codable {
public enum BarcodeFormat: String, Codable, Sendable {
case pdf417
case qr
case aztec
Expand Down
18 changes: 9 additions & 9 deletions Sources/WalletPasses/PassJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public enum PassJSON {
/// A protocol that defines the structure of a `pass.json` file.
///
/// > Tip: See the [`Pass`](https://developer.apple.com/documentation/walletpasses/pass) object to understand the keys.
public protocol Properties: Codable {
public protocol Properties: Codable, Sendable {
/// A short description that iOS accessibility technologies use for a pass.
var description: String { get }

Expand Down Expand Up @@ -34,7 +34,7 @@ extension PassJSON {
/// A protocol that represents the information to display in a field on a pass.
///
/// > Tip: See the [`PassFieldContent`](https://developer.apple.com/documentation/walletpasses/passfieldcontent) object to understand the keys.
public protocol PassFieldContent: Codable {
public protocol PassFieldContent: Codable, Sendable {
/// A unique key that identifies a field in the pass; for example, `departure-gate`.
var key: String { get }

Expand All @@ -49,7 +49,7 @@ extension PassJSON {
/// A protocol that represents the groups of fields that display the information for a boarding pass.
///
/// > Tip: See the [`Pass.BoardingPass`](https://developer.apple.com/documentation/walletpasses/pass/boardingpass) object to understand the keys.
public protocol BoardingPass: Codable {
public protocol BoardingPass: Codable, Sendable {
/// The type of transit for a boarding pass.
///
/// This key is invalid for other types of passes.
Expand All @@ -64,7 +64,7 @@ extension PassJSON {
/// A protocol that represents a barcode on a pass.
///
/// > Tip: See the [`Pass.Barcodes`](https://developer.apple.com/documentation/walletpasses/pass/barcodes) object to understand the keys.
public protocol Barcodes: Codable {
public protocol Barcodes: Codable, Sendable {
/// The format of the barcode.
///
/// The barcode format `PKBarcodeFormatCode128` isn’t supported for watchOS.
Expand All @@ -83,7 +83,7 @@ extension PassJSON {
/// A protocol that represents a location that the system uses to show a relevant pass.
///
/// > Tip: See the [`Pass.Locations`](https://developer.apple.com/documentation/walletpasses/pass/locations) object to understand the keys.
public protocol Locations: Codable {
public protocol Locations: Codable, Sendable {
/// The latitude, in degrees, of the location.
var latitude: Double { get }

Expand All @@ -96,7 +96,7 @@ extension PassJSON {
/// An object that represents the near-field communication (NFC) payload the device passes to an Apple Pay terminal.
///
/// > Tip: See the [`Pass.NFC`](https://developer.apple.com/documentation/walletpasses/pass/nfc) object to understand the keys.
public protocol NFC: Codable {
public protocol NFC: Codable, Sendable {
/// The payload the device transmits to the Apple Pay terminal.
///
/// The size must be no more than 64 bytes.
Expand All @@ -112,13 +112,13 @@ extension PassJSON {

extension PassJSON {
/// The version of the file format.
public enum FormatVersion: Int, Codable {
public enum FormatVersion: Int, Codable, Sendable {
/// The value must be `1`.
case v1 = 1
}

/// The type of transit for a boarding pass.
public enum TransitType: String, Codable {
public enum TransitType: String, Codable, Sendable {
case air = "PKTransitTypeAir"
case boat = "PKTransitTypeBoat"
case bus = "PKTransitTypeBus"
Expand All @@ -127,7 +127,7 @@ extension PassJSON {
}

/// The format of the barcode.
public enum BarcodeFormat: String, Codable {
public enum BarcodeFormat: String, Codable, Sendable {
case pdf417 = "PKBarcodeFormatPDF417"
case qr = "PKBarcodeFormatQR"
case aztec = "PKBarcodeFormatAztec"
Expand Down

0 comments on commit f0b8d92

Please sign in to comment.