From f3b58ca0a99404425bb6f34aa30ed52a66efc893 Mon Sep 17 00:00:00 2001 From: David Mohundro Date: Tue, 13 Aug 2024 10:44:56 -0500 Subject: [PATCH] chore: swiftlint tweaks --- .github/workflows/main.yml | 2 +- Source/FullXMLParser.swift | 7 +++---- Source/LazyXMLParser.swift | 7 +++---- Source/XMLAttribute.swift | 5 ----- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b30bfc3..cd7dcf6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: run: | set -o pipefail xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash OSX" | xcpretty - xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash iOS" -sdk iphonesimulator -destination "OS=16.2,name=iPhone 13" | xcpretty + xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash iOS" -sdk iphonesimulator -destination "OS=17.2,name=iPhone 15" | xcpretty xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash tvOS" -sdk appletvsimulator -destination "name=Apple TV" | xcpretty xcodebuild build $WORKSPACE -scheme "SWXMLHash watchOS" -sdk watchsimulator | xcpretty bash <(curl -s https://codecov.io/bash) -t ${{secrets.CODECOV_TOKEN}} diff --git a/Source/FullXMLParser.swift b/Source/FullXMLParser.swift index ed91ce4..6dda44b 100644 --- a/Source/FullXMLParser.swift +++ b/Source/FullXMLParser.swift @@ -87,11 +87,10 @@ class FullXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { } func parser(_ parser: XMLParser, foundCDATA CDATABlock: Data) { - if let cdataText = String(data: CDATABlock, encoding: String.Encoding.utf8) { - let current = parentStack.top() + let cdataText = String(decoding: CDATABlock, as: UTF8.self) + let current = parentStack.top() - current.addText(cdataText) - } + current.addText(cdataText) } func parser(_ parser: XMLParser, parseErrorOccurred parseError: Error) { diff --git a/Source/LazyXMLParser.swift b/Source/LazyXMLParser.swift index dd9d2ff..bbc993b 100644 --- a/Source/LazyXMLParser.swift +++ b/Source/LazyXMLParser.swift @@ -95,11 +95,10 @@ class LazyXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { return } - if let cdataText = String(data: CDATABlock, encoding: String.Encoding.utf8) { - let current = parentStack.top() + let cdataText = String(decoding: CDATABlock, as: UTF8.self) + let current = parentStack.top() - current.addText(cdataText) - } + current.addText(cdataText) } func parser(_ parser: XMLParser, diff --git a/Source/XMLAttribute.swift b/Source/XMLAttribute.swift index 300be3d..2b58b39 100644 --- a/Source/XMLAttribute.swift +++ b/Source/XMLAttribute.swift @@ -28,11 +28,6 @@ import Foundation public struct XMLAttribute { public let name: String public let text: String - - init(name: String, text: String) { - self.name = name - self.text = text - } } extension XMLAttribute: CustomStringConvertible {