Closed sharplet closed 5 years ago
@sharplet thank you for the PR! Would you mind adding a short example of use with Combine to README and also a unit test (maybe based on the example code)?
Added a test case and a new section to the README, let me know what you think!
Looks like the swiftpm tests are failing on CI, possibly because the Swift compiler version isn't recent enough to know about the macCatalyst
platform? I could add a #if !os(Linux)
conditional to the new test case, which feels a little clunky but should work.
One other option would be to just drop macCatalyst
from the availability annotation. I've pushed a commit which explicitly excludes Linux, in case you're happy with that option.
!os(Linux)
didn't work, and I released that because Catalyst is brand new there should always be a version of Combine available. 🤞
Good news: CombineTests
is actually running now on the Xcode 11 job, but it's crashing, which might be because the job is linking against the macOS SDK, but is running on 10.14 where Combine.framework isn't available at runtime. That test run might need to use the iOS SDK in order to successfully link against Combine.
This enables use of
XMLDecoder
with Combine'sdecode(_:decoder:)
operator by conditionally conforming toTopLevelDecoder
when Combine is available.I explored doing the same for
TopLevelEncoder
, butXMLEncoder
currently requiresrootKey:
to be specified at encoding time, so it's not possible to provide an implementation ofencode(_:)
without some design around how to dynamically determine the root key to use.