From c675e3f217ac35787982c35ba24165eea301f418 Mon Sep 17 00:00:00 2001 From: Marius Felkner Date: Sat, 27 Apr 2024 12:59:25 +0200 Subject: [PATCH] fix: compiler errors for older swift versions --- .swiftformat | 3 ++- .../SemanticVersionComparable/SemanticVersionComparable.swift | 4 ++-- Sources/Version.swift | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.swiftformat b/.swiftformat index 00b9200..fdc09df 100644 --- a/.swiftformat +++ b/.swiftformat @@ -49,4 +49,5 @@ --enable noExplicitOwnership --enable wrapConditionalBodies --enable wrapEnumCases ---enable wrapMultilineConditionalAssignment \ No newline at end of file +--enable wrapMultilineConditionalAssignment +--disable preferKeyPath \ No newline at end of file diff --git a/Sources/SemanticVersionComparable/SemanticVersionComparable.swift b/Sources/SemanticVersionComparable/SemanticVersionComparable.swift index a00289a..d08c0e3 100644 --- a/Sources/SemanticVersionComparable/SemanticVersionComparable.swift +++ b/Sources/SemanticVersionComparable/SemanticVersionComparable.swift @@ -149,14 +149,14 @@ public extension SemanticVersionComparable { /// The pre-release identifier as a string if available. var prereleaseIdentifierString: String? { prerelease? - .compactMap(\.value) + .compactMap { $0.value } .joined(separator: ".") } /// The build-meta-data as a string if available. var buildMetaDataString: String? { build? - .compactMap(\.value) + .compactMap { $0.value } .joined(separator: ".") } } diff --git a/Sources/Version.swift b/Sources/Version.swift index 60c870e..7acfe23 100644 --- a/Sources/Version.swift +++ b/Sources/Version.swift @@ -196,9 +196,7 @@ public struct Version: Sendable, SemanticVersionComparable { build = String(buildSubstring) .split(separator: ".") .map(String.init) - .compactMap { - BuildMetaData($0) - } + .compactMap { BuildMetaData($0) } // finding an .unkown element means that the given string is not conform to `SemVer` since it is no // alphaNumeric or a digit if