Skip to content

Commit

Permalink
Conditionally conform to Combine.TopLevelDecoder (CoreOffice#132)
Browse files Browse the repository at this point in the history
This enables use of `XMLDecoder` with Combine's `decode(_:decoder:)` operator by conditionally conforming to `TopLevelDecoder` when Combine is available.

I explored doing the same for `TopLevelEncoder`, but `XMLEncoder` currently requires `rootKey:` to be specified at encoding time, so it's not possible to provide an implementation of `encode(_:)` without some design around how to dynamically determine the root key to use.

* Conditionally conform to Combine.TopLevelDecoder
* Add test and documentation for Combine integration
* Remove macCatalyst from CombineTests
This shouldn't be necessary because all versions of Mac Catalyst should
have a version of Combine available.
* Add CombineTests to the Xcode project
* Disable CombineTests on macOS
  • Loading branch information
sharplet authored and bwetherfield committed Oct 16, 2019
1 parent 4c713a9 commit 70c55ec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,16 @@ extension IntOrString: Codable {
This is described in more details in PR [\#119](https://github.com/MaxDesiatov/XMLCoder/pull/119)
by [@jsbean](https://github.com/jsbean) and [@bwetherfield](https://github.com/bwetherfield).

<<<<<<< HEAD
### Integrating with [Combine](https://developer.apple.com/documentation/combine)

Starting with XMLCoder [version 0.9](https://github.com/MaxDesiatov/XMLCoder/releases/tag/0.9.0),
when Apple's Combine framework is available, `XMLDecoder` conforms to the
=======
## Integrating with [Combine](https://developer.apple.com/documentation/combine)

When Apple's Combine framework is available, `XMLDecoder` conforms to the
>>>>>>> Conditionally conform to Combine.TopLevelDecoder (#132)
`TopLevelDecoder` protocol, which allows it to be used with the
`decode(type:decoder:)` operator:

Expand Down

0 comments on commit 70c55ec

Please sign in to comment.