Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TopLevelEncoder implementation #175

Merged
merged 1 commit into from
Apr 13, 2020
Merged

Conversation

MaxDesiatov
Copy link
Collaborator

No description provided.

@MaxDesiatov MaxDesiatov added the enhancement New feature or request label Apr 13, 2020
@codecov
Copy link

codecov bot commented Apr 13, 2020

Codecov Report

Merging #175 into master will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #175      +/-   ##
==========================================
+ Coverage   73.06%   73.12%   +0.06%     
==========================================
  Files          43       43              
  Lines        2309     2311       +2     
==========================================
+ Hits         1687     1690       +3     
+ Misses        622      621       -1     
Impacted Files Coverage Δ
Sources/XMLCoder/Decoder/XMLDecoder.swift 76.64% <100.00%> (+0.34%) ⬆️
Sources/XMLCoder/Encoder/XMLEncoder.swift 84.25% <0.00%> (+0.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d57b8f2...18b4ec0. Read the comment docs.

@MaxDesiatov MaxDesiatov merged commit 9eb98ba into master Apr 13, 2020
@MaxDesiatov MaxDesiatov deleted the maxd/combine-encoder branch April 13, 2020 16:21
MaxDesiatov pushed a commit that referenced this pull request May 20, 2020
`TopLevelEncoder` implementation was added by #175. However, its method cannot be overridden. If it can be, we can use custom root key, root attributes, or header even when we use Combine-style like this:

```swift
final class MyEncoder: XMLEncoder {
    override func encode<T>(_ value: T) throws -> Data where T : Encodable {
        try self.encode(value, withRootKey: "foo", rootAttributes: nil, header: XMLHeader(version: 1.0, encoding: "UTF-8"))
    }
}
```
arjungupta0107 pushed a commit to salido/XMLCoder that referenced this pull request Jun 26, 2020
arjungupta0107 pushed a commit to salido/XMLCoder that referenced this pull request Jun 26, 2020
`TopLevelEncoder` implementation was added by CoreOffice#175. However, its method cannot be overridden. If it can be, we can use custom root key, root attributes, or header even when we use Combine-style like this:

```swift
final class MyEncoder: XMLEncoder {
    override func encode<T>(_ value: T) throws -> Data where T : Encodable {
        try self.encode(value, withRootKey: "foo", rootAttributes: nil, header: XMLHeader(version: 1.0, encoding: "UTF-8"))
    }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant