From 32d632f34867049710d200c4ec60b8d90e964c2b Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Wed, 2 Jan 2019 16:04:58 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20unnecessary=20use=20of=20`@available(?= =?UTF-8?q?=E2=80=A6)`=20for=20`OutputFormatting.sortedKeys`=20(#53)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/XMLCoder/Auxiliaries/XMLElement.swift | 16 ++++++---------- Sources/XMLCoder/Encoder/XMLEncoder.swift | 1 - 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Sources/XMLCoder/Auxiliaries/XMLElement.swift b/Sources/XMLCoder/Auxiliaries/XMLElement.swift index fec84ec2..30e82fb5 100644 --- a/Sources/XMLCoder/Auxiliaries/XMLElement.swift +++ b/Sources/XMLCoder/Auxiliaries/XMLElement.swift @@ -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) } diff --git a/Sources/XMLCoder/Encoder/XMLEncoder.swift b/Sources/XMLCoder/Encoder/XMLEncoder.swift index c575d25c..211acb3a 100644 --- a/Sources/XMLCoder/Encoder/XMLEncoder.swift +++ b/Sources/XMLCoder/Encoder/XMLEncoder.swift @@ -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) }