From fa7a2e563636b11526fc9ec3d37261e54c287f4c Mon Sep 17 00:00:00 2001 From: Michael Bisgaard Olesen Date: Wed, 17 Jan 2024 14:01:33 +0100 Subject: [PATCH] Set swift version for formatter This allows the formatter to perform rewrites that only work in newer versions of Swift. --- .swift-version | 1 + .../ConcordiumSwiftSDK/Extensions/Data+Helper.swift | 2 +- Sources/ConcordiumSwiftSDK/Model/Account.swift | 12 +++--------- 3 files changed, 5 insertions(+), 10 deletions(-) create mode 100644 .swift-version diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..2df33d7 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +5.6 diff --git a/Sources/ConcordiumSwiftSDK/Extensions/Data+Helper.swift b/Sources/ConcordiumSwiftSDK/Extensions/Data+Helper.swift index 8c0d1b5..a8f3961 100644 --- a/Sources/ConcordiumSwiftSDK/Extensions/Data+Helper.swift +++ b/Sources/ConcordiumSwiftSDK/Extensions/Data+Helper.swift @@ -23,6 +23,6 @@ public extension Data { } func hexadecimalString() -> String { - return map { String(format: "%02hhx", $0) }.joined() + map { String(format: "%02hhx", $0) }.joined() } } diff --git a/Sources/ConcordiumSwiftSDK/Model/Account.swift b/Sources/ConcordiumSwiftSDK/Model/Account.swift index 60ba294..4a17d78 100644 --- a/Sources/ConcordiumSwiftSDK/Model/Account.swift +++ b/Sources/ConcordiumSwiftSDK/Model/Account.swift @@ -113,9 +113,7 @@ public struct Release { .init( timestamp: dateFromUnixTimeMillis(grpc.timestamp.value), amount: grpc.amount.value, - transactions: grpc.transactions.map { - $0.value - } + transactions: grpc.transactions.map(\.value) ) } } @@ -332,9 +330,7 @@ public enum AccountCredentialWithoutProofs { attributes: v.commitments.attributes.mapValues { $0.value }, - idCredSecSharingCoeff: v.commitments.idCredSecSharingCoeff.map { - $0.value - } + idCredSecSharingCoeff: v.commitments.idCredSecSharingCoeff.map(\.value) ) ) } @@ -375,9 +371,7 @@ public struct AccountEncryptedAmount { selfAmount: grpc.selfAmount.value, startIndex: grpc.startIndex, aggregatedAmount: grpc.aggregatedAmount.value, - incomingAmounts: grpc.incomingAmounts.map { - $0.value - } + incomingAmounts: grpc.incomingAmounts.map(\.value) ) } }