Skip to content

Commit

Permalink
Remove unnecessary use of @available(…) for `OutputFormatting.sorte…
Browse files Browse the repository at this point in the history
…dKeys` (#53)
  • Loading branch information
regexident authored and hodovani committed Jan 2, 2019
1 parent d4e7673 commit 32d632f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
16 changes: 6 additions & 10 deletions Sources/XMLCoder/Auxiliaries/XMLElement.swift
Expand Up @@ -182,21 +182,17 @@ struct _XMLElement {
}

fileprivate func formatXMLAttributes(_ formatting: XMLEncoder.OutputFormatting, _ string: inout String) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if formatting.contains(.sortedKeys) {
formatSortedXMLAttributes(&string)
return
}
if formatting.contains(.sortedKeys) {
formatSortedXMLAttributes(&string)
return
}
formatUnsortedXMLAttributes(&string)
}

fileprivate func formatXMLElements(_ formatting: XMLEncoder.OutputFormatting, _ string: inout String, _ level: Int, _ cdata: Bool, _ prettyPrinted: Bool) {
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
if formatting.contains(.sortedKeys) {
formatSortedXMLElements(&string, level, cdata, formatting, prettyPrinted)
return
}
if formatting.contains(.sortedKeys) {
formatSortedXMLElements(&string, level, cdata, formatting, prettyPrinted)
return
}
formatUnsortedXMLElements(&string, level, cdata, formatting, prettyPrinted)
}
Expand Down
1 change: 0 additions & 1 deletion Sources/XMLCoder/Encoder/XMLEncoder.swift
Expand Up @@ -30,7 +30,6 @@ open class XMLEncoder {
public static let prettyPrinted = OutputFormatting(rawValue: 1 << 0)

/// Produce XML with keys sorted in lexicographic order.
@available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *)
public static let sortedKeys = OutputFormatting(rawValue: 1 << 1)
}

Expand Down

0 comments on commit 32d632f

Please sign in to comment.