Skip to content

Commit e473187

Browse files
author
Joe Newton
committed
Added conformance to TopLevelEncoder and TopLevelDecoder where applicable
1 parent 7fe3a29 commit e473187

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CBORCoding/CBORDecoder.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import Foundation
1010

11+
#if canImport(Combine)
12+
import Combine
13+
#endif // #if canImport(Combine)
14+
1115
// MARK: - CBORDecoder Definition
1216

1317
/// An object that decodes instances of a data type from CBOR objects.
@@ -1058,3 +1062,9 @@ extension DecodingError {
10581062
return .typeMismatch(expectation, Context(codingPath: path, debugDescription: description))
10591063
}
10601064
}
1065+
1066+
// MARK: - CBORDecoder Extension
1067+
1068+
#if canImport(Combine)
1069+
extension CBORDecoder: TopLevelDecoder { }
1070+
#endif // #if canImport(Combine)

CBORCoding/CBOREncoder.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import Foundation
1010

11+
#if canImport(Combine)
12+
import Combine
13+
#endif // #if canImport(Combine)
14+
1115
// MARK: - CBOREncoder Definition
1216

1317
/// An object that encodes instances of a data type as CBOR objects.
@@ -1119,3 +1123,9 @@ private class __CBORReferencingEncoder: __CBOREncoder {
11191123
return storage.count == codingPath.count - encoder.codingPath.count - 1
11201124
}
11211125
}
1126+
1127+
// MARK: - CBOREncoder Extension
1128+
1129+
#if canImport(Combine)
1130+
extension CBOREncoder: TopLevelEncoder { }
1131+
#endif // #if canImport(Combine)

0 commit comments

Comments
 (0)