Skip to content

Commit 11115e9

Browse files
Merge pull request #7 from SomeRandomiOSDev/1.0.5
Added conformance to `TopLevelEncoder` and `TopLevelDecoder`
2 parents 7fe3a29 + 03833c9 commit 11115e9

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CBORCoding.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "CBORCoding"
4-
s.version = "1.0.4"
4+
s.version = "1.0.5"
55
s.summary = "A CBOR Encoder and Decoder"
66
s.description = <<-DESC
77
A lightweight framework containing a coder pair for encoding and decoding `Codable` conforming types to and from CBOR document format for iOS, macOS, tvOS, and watchOS.

CBORCoding/CBORDecoder.swift

+10
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

+10
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)