Skip to content

Commit 8ccf6ed

Browse files
committed
First pass at marking types as Sendable
1 parent 8fad4d5 commit 8ccf6ed

25 files changed

+37
-37
lines changed

Sources/Internal/JSON.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88

99
/// Wraps a dictionary parsed from a JSON string.
1010
/// This is a trick to keep the Web Publication structs equatable without having to override `==` and compare all the other properties.
11-
public struct JSONDictionary {
11+
public struct JSONDictionary: @unchecked Sendable {
1212
public var json: [String: Any]
1313

1414
public init() {

Sources/Shared/Publication/Accessibility.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ReadiumInternal
1111
///
1212
/// https://www.w3.org/2021/a11y-discov-vocab/latest/
1313
/// https://readium.org/webpub-manifest/schema/a11y.schema.json
14-
public struct Accessibility: Hashable {
14+
public struct Accessibility: Hashable, Sendable {
1515
/// An established standard to which the described resource conforms.
1616
public var conformsTo: [Profile]
1717

@@ -49,7 +49,7 @@ public struct Accessibility: Hashable {
4949
public var hazards: [Hazard]
5050

5151
/// Accessibility profile.
52-
public struct Profile: Hashable {
52+
public struct Profile: Hashable, Sendable {
5353
public let uri: String
5454

5555
public init(_ uri: String) {
@@ -64,7 +64,7 @@ public struct Accessibility: Hashable {
6464
public static let epubA11y10WCAG20AAA = Profile("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa")
6565
}
6666

67-
public struct Certification: Hashable {
67+
public struct Certification: Hashable, Sendable {
6868
/// Identifies a party responsible for the testing and certification of the accessibility of a Publication.
6969
///
7070
/// https://www.w3.org/TR/epub-a11y/#certifiedBy
@@ -89,7 +89,7 @@ public struct Accessibility: Hashable {
8989
}
9090
}
9191

92-
public struct AccessMode: Hashable {
92+
public struct AccessMode: Hashable, Sendable {
9393
public let id: String
9494

9595
public init(_ id: String) {
@@ -134,7 +134,7 @@ public struct Accessibility: Hashable {
134134
public static let visual = AccessMode("visual")
135135
}
136136

137-
public enum PrimaryAccessMode: String, Hashable {
137+
public enum PrimaryAccessMode: String, Hashable, Sendable {
138138
/// Indicates that auditory perception is necessary to consume the information.
139139
case auditory
140140

@@ -151,7 +151,7 @@ public struct Accessibility: Hashable {
151151
case visual
152152
}
153153

154-
public struct Feature: Hashable {
154+
public struct Feature: Hashable, Sendable {
155155
public let id: String
156156

157157
public init(_ id: String) {
@@ -306,7 +306,7 @@ public struct Accessibility: Hashable {
306306
public static let none = Feature("none")
307307
}
308308

309-
public struct Hazard: Hashable {
309+
public struct Hazard: Hashable, Sendable {
310310
public let id: String
311311

312312
public init(_ id: String) {

Sources/Shared/Publication/Asset/FileAsset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Foundation
88

99
/// Represents a publication stored as a file on the local file system.
10-
public final class FileAsset: PublicationAsset, Loggable {
10+
public final class FileAsset: PublicationAsset, Loggable, Sendable {
1111
/// File URL on the file system.
1212
public let file: FileURL
1313

Sources/Shared/Publication/Asset/PublicationAsset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Foundation
88

99
/// Represents a digital medium (e.g. a file) offering access to a publication.
10-
public protocol PublicationAsset {
10+
public protocol PublicationAsset: Sendable {
1111
/// Name of the asset, e.g. a filename.
1212
var name: String { get }
1313

Sources/Shared/Publication/Contributor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88
import ReadiumInternal
99

1010
/// https://readium.org/webpub-manifest/schema/contributor-object.schema.json
11-
public struct Contributor: Hashable {
11+
public struct Contributor: Hashable, Sendable {
1212
/// The name of the contributor.
1313
public var localizedName: LocalizedString
1414
public var name: String { localizedName.string }

Sources/Shared/Publication/Link.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public enum LinkError: Error, Equatable {
1414

1515
/// Link Object for the Readium Web Publication Manifest.
1616
/// https://readium.org/webpub-manifest/schema/link.schema.json
17-
public struct Link: JSONEquatable, Hashable {
17+
public struct Link: JSONEquatable, Hashable, Sendable {
1818
/// URI or URI template of the linked resource.
1919
/// Note: a String because templates are lost with URL.
2020
public var href: String // URI

Sources/Shared/Publication/LinkRelation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Foundation
88

99
/// Link relations as defined in https://readium.org/webpub-manifest/relationships.html
10-
public struct LinkRelation {
10+
public struct LinkRelation: Sendable {
1111
/// The string representation of this link relation.
1212
public let string: String
1313

Sources/Shared/Publication/LocalizedString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
/// Can be either:
1111
/// - a single nonlocalized string
1212
/// - a dictionary of localized strings indexed by the BCP 47 language tag
13-
public enum LocalizedString: Hashable {
13+
public enum LocalizedString: Hashable, Sendable {
1414
case nonlocalized(String)
1515
case localized([String: String])
1616

Sources/Shared/Publication/Locator.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88
import ReadiumInternal
99

1010
/// https://github.com/readium/architecture/tree/master/locators
11-
public struct Locator: Hashable, CustomStringConvertible, Loggable {
11+
public struct Locator: Hashable, CustomStringConvertible, Loggable, Sendable {
1212
/// The URI of the resource that the Locator Object points to.
1313
public var href: String // URI
1414

@@ -120,7 +120,7 @@ public struct Locator: Hashable, CustomStringConvertible, Loggable {
120120
///
121121
/// Properties are mutable for convenience when making a copy, but the `locations` property
122122
/// is immutable in `Locator`, for safety.
123-
public struct Locations: Hashable, Loggable, WarningLogger {
123+
public struct Locations: Hashable, Loggable, WarningLogger, Sendable {
124124
/// Contains one or more fragment in the resource referenced by the `Locator`.
125125
public var fragments: [String]
126126
/// Progression in the resource expressed as a percentage (between 0 and 1).
@@ -197,7 +197,7 @@ public struct Locator: Hashable, CustomStringConvertible, Loggable {
197197
public subscript(key: String) -> Any? { otherLocations[key] }
198198
}
199199

200-
public struct Text: Hashable, Loggable {
200+
public struct Text: Hashable, Loggable, Sendable {
201201
public var after: String?
202202
public var before: String?
203203
public var highlight: String?

Sources/Shared/Publication/Manifest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ReadiumInternal
1111
/// Manifest.
1212
///
1313
/// See. https://readium.org/webpub-manifest/
14-
public struct Manifest: JSONEquatable, Hashable {
14+
public struct Manifest: JSONEquatable, Hashable, Sendable {
1515
public var context: [String] // @context
1616

1717
public var metadata: Metadata

0 commit comments

Comments
 (0)