From a991eaf789fc66bd232d3e7e28d80c074ecd2ee9 Mon Sep 17 00:00:00 2001 From: Roman Fedyanin Date: Fri, 10 Jan 2025 18:21:17 +0300 Subject: [PATCH 1/8] Updated swift version --- .swift-version | 2 +- .xcode-version | 2 +- DictionaryCoder.podspec | 10 +++---- DictionaryCoder.xcodeproj/project.pbxproj | 34 ++++++++++++++++------- Package.swift | 9 ++++-- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/.swift-version b/.swift-version index 9ad974f..e0ea36f 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.5 +6.0 diff --git a/.xcode-version b/.xcode-version index 9dc0691..c32b0ec 100644 --- a/.xcode-version +++ b/.xcode-version @@ -1 +1 @@ -14.1 +16.1 diff --git a/DictionaryCoder.podspec b/DictionaryCoder.podspec index 69ad8f4..96c0dd2 100644 --- a/DictionaryCoder.podspec +++ b/DictionaryCoder.podspec @@ -8,19 +8,19 @@ Pod::Spec.new do |spec| spec.author = { "Almaz Ibragimov" => "almazrafi@gmail.com" } spec.source = { :git => "https://github.com/almazrafi/DictionaryCoder.git", :tag => "#{spec.version}" } - spec.swift_version = '5.5' + spec.swift_version = '6.0' spec.requires_arc = true spec.source_files = 'Sources/**/*.swift' spec.ios.frameworks = 'Foundation' - spec.ios.deployment_target = "12.0" + spec.ios.deployment_target = "13.0" spec.osx.frameworks = 'Foundation' - spec.osx.deployment_target = "10.14" + spec.osx.deployment_target = "11.5" spec.watchos.frameworks = 'Foundation' - spec.watchos.deployment_target = "5.0" + spec.watchos.deployment_target = "6.0" spec.tvos.frameworks = 'Foundation' - spec.tvos.deployment_target = "12.0" + spec.tvos.deployment_target = "13.0" end diff --git a/DictionaryCoder.xcodeproj/project.pbxproj b/DictionaryCoder.xcodeproj/project.pbxproj index 0e81f8a..1fd75f0 100644 --- a/DictionaryCoder.xcodeproj/project.pbxproj +++ b/DictionaryCoder.xcodeproj/project.pbxproj @@ -1002,6 +1002,7 @@ SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 6.0; }; name = Debug; }; @@ -1028,6 +1029,7 @@ SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 6.0; }; name = Release; }; @@ -1083,19 +1085,19 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MACOSX_DEPLOYMENT_TARGET = 10.14; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MACOSX_DEPLOYMENT_TARGET = 11.5; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.5; - TVOS_DEPLOYMENT_TARGET = 12.0; + SWIFT_VERSION = 6.0; + TVOS_DEPLOYMENT_TARGET = 13.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 5.0; + WATCHOS_DEPLOYMENT_TARGET = 6.0; }; name = Debug; }; @@ -1145,20 +1147,20 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - MACOSX_DEPLOYMENT_TARGET = 10.14; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MACOSX_DEPLOYMENT_TARGET = 11.5; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; SKIP_SWIFTLINT = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.5; - TVOS_DEPLOYMENT_TARGET = 12.0; + SWIFT_VERSION = 6.0; + TVOS_DEPLOYMENT_TARGET = 13.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; - WATCHOS_DEPLOYMENT_TARGET = 5.0; + WATCHOS_DEPLOYMENT_TARGET = 6.0; }; name = Release; }; @@ -1175,6 +1177,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Sources/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1201,6 +1204,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Sources/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1221,6 +1225,7 @@ CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1239,6 +1244,7 @@ CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1269,6 +1275,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.5; MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.almazrafi.DictionaryCoder; PRODUCT_NAME = DictionaryCoder; @@ -1296,6 +1303,7 @@ "@executable_path/../Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.5; MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.almazrafi.DictionaryCoder; PRODUCT_NAME = DictionaryCoder; @@ -1317,6 +1325,7 @@ "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.5; PRODUCT_BUNDLE_IDENTIFIER = "com.almazrafi.DictionaryCoder.Tests-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; @@ -1336,6 +1345,7 @@ "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 11.5; PRODUCT_BUNDLE_IDENTIFIER = "com.almazrafi.DictionaryCoder.Tests-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; @@ -1366,6 +1376,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 13.0; }; name = Debug; }; @@ -1393,6 +1404,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 13.0; }; name = Release; }; @@ -1412,6 +1424,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 13.0; }; name = Debug; }; @@ -1431,6 +1444,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 13.0; }; name = Release; }; diff --git a/Package.swift b/Package.swift index 215be64..ced524d 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.5 +// swift-tools-version:6.0 import PackageDescription let package = Package( @@ -12,7 +12,10 @@ let package = Package( targets: [ .target( name: "DictionaryCoder", - path: "Sources" + path: "Sources", + swiftSettings: [ + .enableUpcomingFeature("StrictConcurrency") + ] ), .testTarget( name: "DictionaryCoderTests", @@ -20,5 +23,5 @@ let package = Package( path: "Tests" ) ], - swiftLanguageVersions: [.v5] + swiftLanguageVersions: [.v6] ) From 2ba78b5bf25da481dc65d48ef74977dd4990e76f Mon Sep 17 00:00:00 2001 From: Roman Fedyanin Date: Fri, 10 Jan 2025 18:21:25 +0300 Subject: [PATCH 2/8] Removed Decoder and Encoder singletons --- Sources/Decoder/DictionaryDecoder.swift | 4 ---- Sources/Encoder/DictionaryEncoder.swift | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Sources/Decoder/DictionaryDecoder.swift b/Sources/Decoder/DictionaryDecoder.swift index 47e4824..ed00486 100644 --- a/Sources/Decoder/DictionaryDecoder.swift +++ b/Sources/Decoder/DictionaryDecoder.swift @@ -2,10 +2,6 @@ import Foundation public final class DictionaryDecoder { - // MARK: - Type Properties - - public static let `default` = DictionaryDecoder() - // MARK: - Instance Properties public var dateDecodingStrategy: DictionaryDateDecodingStrategy diff --git a/Sources/Encoder/DictionaryEncoder.swift b/Sources/Encoder/DictionaryEncoder.swift index 90137c0..e03f8f6 100644 --- a/Sources/Encoder/DictionaryEncoder.swift +++ b/Sources/Encoder/DictionaryEncoder.swift @@ -2,10 +2,6 @@ import Foundation public final class DictionaryEncoder { - // MARK: - Type Properties - - public static let `default` = DictionaryEncoder() - // MARK: - Instance Properties public var dateEncodingStrategy: DictionaryDateEncodingStrategy From 11da9a63db48260c3b2f7a1ed6c9101119eee0ca Mon Sep 17 00:00:00 2001 From: Fedyanin Roman Date: Fri, 10 Jan 2025 18:37:59 +0300 Subject: [PATCH 3/8] Update ci.yml --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfcb141..1054187 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,21 +15,21 @@ env: jobs: BuildAndTests: name: Build & Tests - runs-on: macOS-13 + runs-on: macOS-14 env: - DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_16.1.0.app/Contents/Developer XCODE_PROJECT: DictionaryCoder.xcodeproj IOS_SCHEME: DictionaryCoder iOS - IOS_DESTINATION: OS=17.2,name=iPhone 15 + IOS_DESTINATION: OS=18.1,name=iPhone 16 IOS_RESULT_PATH: xcodebuild-ios.xcresult MACOS_SCHEME: DictionaryCoder macOS MACOS_DESTINATION: platform=macOS MACOS_RESULT_PATH: xcodebuild-macos.xcresult TVOS_SCHEME: DictionaryCoder tvOS - TVOS_DESTINATION: OS=17.2,name=Apple TV + TVOS_DESTINATION: OS=18.1,name=Apple TV TVOS_RESULT_PATH: xcodebuild-tvos.xcresult WATCHOS_SCHEME: DictionaryCoder watchOS - WATCHOS_DESTINATION: OS=10.2,name=Apple Watch Series 9 (45mm) + WATCHOS_DESTINATION: OS=11.1,name=Apple Watch Series 10 (45mm) WATCHOS_RESULT_PATH: xcodebuild-watchos.xcresult SKIP_SWIFTLINT: YES DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} From f2240f951627e443f67b3683c40d0cd6152643b3 Mon Sep 17 00:00:00 2001 From: Fedyanin Roman Date: Fri, 10 Jan 2025 19:10:27 +0300 Subject: [PATCH 4/8] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1054187..014009c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,9 @@ env: jobs: BuildAndTests: name: Build & Tests - runs-on: macOS-14 + runs-on: macOS-15 env: - DEVELOPER_DIR: /Applications/Xcode_16.1.0.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_16.2.0.app/Contents/Developer XCODE_PROJECT: DictionaryCoder.xcodeproj IOS_SCHEME: DictionaryCoder iOS IOS_DESTINATION: OS=18.1,name=iPhone 16 From 1547a9d103f2ca7251b36e88672ba53a53c67b2f Mon Sep 17 00:00:00 2001 From: Fedyanin Roman Date: Fri, 10 Jan 2025 19:13:44 +0300 Subject: [PATCH 5/8] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 014009c..3f827c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: Cocoapods: name: Cocoapods - runs-on: macOS-latest + runs-on: macOS-15 steps: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 @@ -96,7 +96,7 @@ jobs: SPM: name: Swift Package Manager - runs-on: macOS-latest + runs-on: macOS-15 steps: - uses: actions/checkout@v3 - name: Build From d0b9f2ffc4fa327410dd8a0b12e13d26b3c2e7a6 Mon Sep 17 00:00:00 2001 From: Roman Fedyanin Date: Fri, 10 Jan 2025 19:18:20 +0300 Subject: [PATCH 6/8] Removed StrictConcurrency swift setting --- Package.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index ced524d..1018e37 100644 --- a/Package.swift +++ b/Package.swift @@ -12,10 +12,7 @@ let package = Package( targets: [ .target( name: "DictionaryCoder", - path: "Sources", - swiftSettings: [ - .enableUpcomingFeature("StrictConcurrency") - ] + path: "Sources" ), .testTarget( name: "DictionaryCoderTests", From ee1d9bcf5f237afccde18326fc65d3dca7ec6399 Mon Sep 17 00:00:00 2001 From: Roman Fedyanin Date: Thu, 17 Apr 2025 14:56:19 +0300 Subject: [PATCH 7/8] Trigger CI From a4f7f975e4d637a8b385e968338e1efa6d96c7fa Mon Sep 17 00:00:00 2001 From: Roman Fedyanin Date: Mon, 23 Jun 2025 15:34:57 +0300 Subject: [PATCH 8/8] Sendable in Decoder and Encoder --- Sources/Decoder/DictionaryDecoder.swift | 14 ++++++------- .../DictionaryDataDecodingStrategy.swift | 4 ++-- .../DictionaryDateDecodingStrategy.swift | 4 ++-- .../DictionaryKeyDecodingStrategy.swift | 4 ++-- ...ryNonConformingFloatDecodingStrategy.swift | 2 +- Sources/Encoder/DictionaryEncoder.swift | 20 +++++++++---------- .../DictionaryDataEncodingStrategy.swift | 4 ++-- .../DictionaryDateEncodingStrategy.swift | 4 ++-- .../DictionaryKeyEncodingStrategy.swift | 4 ++-- .../DictionaryNilEncodingStrategy.swift | 2 +- ...ryNonConformingFloatEncodingStrategy.swift | 2 +- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Sources/Decoder/DictionaryDecoder.swift b/Sources/Decoder/DictionaryDecoder.swift index ed00486..1065c6f 100644 --- a/Sources/Decoder/DictionaryDecoder.swift +++ b/Sources/Decoder/DictionaryDecoder.swift @@ -1,14 +1,14 @@ import Foundation -public final class DictionaryDecoder { +public final class DictionaryDecoder: Sendable { // MARK: - Instance Properties - public var dateDecodingStrategy: DictionaryDateDecodingStrategy - public var dataDecodingStrategy: DictionaryDataDecodingStrategy - public var nonConformingFloatDecodingStrategy: DictionaryNonConformingFloatDecodingStrategy - public var keyDecodingStrategy: DictionaryKeyDecodingStrategy - public var userInfo: [CodingUserInfoKey: Any] + public let dateDecodingStrategy: DictionaryDateDecodingStrategy + public let dataDecodingStrategy: DictionaryDataDecodingStrategy + public let nonConformingFloatDecodingStrategy: DictionaryNonConformingFloatDecodingStrategy + public let keyDecodingStrategy: DictionaryKeyDecodingStrategy + public let userInfo: [CodingUserInfoKey: Sendable] // MARK: - Initializers @@ -17,7 +17,7 @@ public final class DictionaryDecoder { dataDecodingStrategy: DictionaryDataDecodingStrategy = .base64, nonConformingFloatDecodingStrategy: DictionaryNonConformingFloatDecodingStrategy = .throw, keyDecodingStrategy: DictionaryKeyDecodingStrategy = .useDefaultKeys, - userInfo: [CodingUserInfoKey: Any] = [:] + userInfo: [CodingUserInfoKey: Sendable] = [:] ) { self.dateDecodingStrategy = dateDecodingStrategy self.dataDecodingStrategy = dataDecodingStrategy diff --git a/Sources/Decoder/Options/DictionaryDataDecodingStrategy.swift b/Sources/Decoder/Options/DictionaryDataDecodingStrategy.swift index 849bf63..0570691 100644 --- a/Sources/Decoder/Options/DictionaryDataDecodingStrategy.swift +++ b/Sources/Decoder/Options/DictionaryDataDecodingStrategy.swift @@ -1,7 +1,7 @@ import Foundation /// The strategies for decoding raw data. -public enum DictionaryDataDecodingStrategy { +public enum DictionaryDataDecodingStrategy: Sendable { // MARK: - Enumeration Cases @@ -12,5 +12,5 @@ public enum DictionaryDataDecodingStrategy { case base64 /// The strategy that decodes data using a user-defined function. - case custom((_ decoder: Decoder) throws -> Data) + case custom(@Sendable (_ decoder: Decoder) throws -> Data) } diff --git a/Sources/Decoder/Options/DictionaryDateDecodingStrategy.swift b/Sources/Decoder/Options/DictionaryDateDecodingStrategy.swift index 154642b..11b36fd 100644 --- a/Sources/Decoder/Options/DictionaryDateDecodingStrategy.swift +++ b/Sources/Decoder/Options/DictionaryDateDecodingStrategy.swift @@ -1,7 +1,7 @@ import Foundation /// The strategies available for formatting dates when decoding them from Dictionary. -public enum DictionaryDateDecodingStrategy { +public enum DictionaryDateDecodingStrategy: Sendable { // MARK: - Enumeration Cases @@ -22,5 +22,5 @@ public enum DictionaryDateDecodingStrategy { case formatted(DateFormatter) /// The strategy that formats custom dates by calling a user-defined function. - case custom((_ decoder: Decoder) throws -> Date) + case custom(@Sendable (_ decoder: Decoder) throws -> Date) } diff --git a/Sources/Decoder/Options/DictionaryKeyDecodingStrategy.swift b/Sources/Decoder/Options/DictionaryKeyDecodingStrategy.swift index 68cf061..b036eef 100644 --- a/Sources/Decoder/Options/DictionaryKeyDecodingStrategy.swift +++ b/Sources/Decoder/Options/DictionaryKeyDecodingStrategy.swift @@ -1,7 +1,7 @@ import Foundation /// The values that determine how to decode a type’s coding keys from Dictionary keys. -public enum DictionaryKeyDecodingStrategy { +public enum DictionaryKeyDecodingStrategy: Sendable { // MARK: - Enumeration Cases @@ -9,5 +9,5 @@ public enum DictionaryKeyDecodingStrategy { case useDefaultKeys /// A key decoding strategy defined by the closure you supply. - case custom((_ codingPath: [CodingKey]) -> CodingKey) + case custom(@Sendable (_ codingPath: [CodingKey]) -> CodingKey) } diff --git a/Sources/Decoder/Options/DictionaryNonConformingFloatDecodingStrategy.swift b/Sources/Decoder/Options/DictionaryNonConformingFloatDecodingStrategy.swift index 2ee89a2..a3dd669 100644 --- a/Sources/Decoder/Options/DictionaryNonConformingFloatDecodingStrategy.swift +++ b/Sources/Decoder/Options/DictionaryNonConformingFloatDecodingStrategy.swift @@ -2,7 +2,7 @@ import Foundation /// The strategies for encoding nonconforming floating-point numbers, /// also known as IEEE 754 exceptional values. -public enum DictionaryNonConformingFloatDecodingStrategy { +public enum DictionaryNonConformingFloatDecodingStrategy: Sendable { // MARK: - Enumeration Cases diff --git a/Sources/Encoder/DictionaryEncoder.swift b/Sources/Encoder/DictionaryEncoder.swift index e03f8f6..b01971f 100644 --- a/Sources/Encoder/DictionaryEncoder.swift +++ b/Sources/Encoder/DictionaryEncoder.swift @@ -1,15 +1,15 @@ import Foundation -public final class DictionaryEncoder { +public final class DictionaryEncoder: Sendable { // MARK: - Instance Properties - public var dateEncodingStrategy: DictionaryDateEncodingStrategy - public var dataEncodingStrategy: DictionaryDataEncodingStrategy - public var nonConformingFloatEncodingStrategy: DictionaryNonConformingFloatEncodingStrategy - public var nilEncodingStrategy: DictionaryNilEncodingStrategy - public var keyEncodingStrategy: DictionaryKeyEncodingStrategy - public var userInfo: [CodingUserInfoKey: Any] + public let dateEncodingStrategy: DictionaryDateEncodingStrategy + public let dataEncodingStrategy: DictionaryDataEncodingStrategy + public let nonConformingFloatEncodingStrategy: DictionaryNonConformingFloatEncodingStrategy + public let nilEncodingStrategy: DictionaryNilEncodingStrategy + public let keyEncodingStrategy: DictionaryKeyEncodingStrategy + public let userInfo: [CodingUserInfoKey: Sendable] // MARK: - Initializers @@ -19,7 +19,7 @@ public final class DictionaryEncoder { nonConformingFloatEncodingStrategy: DictionaryNonConformingFloatEncodingStrategy = .throw, nilEncodingStrategy: DictionaryNilEncodingStrategy = .useNil, keyEncodingStrategy: DictionaryKeyEncodingStrategy = .useDefaultKeys, - userInfo: [CodingUserInfoKey: Any] = [:] + userInfo: [CodingUserInfoKey: Sendable] = [:] ) { self.dateEncodingStrategy = dateEncodingStrategy self.dataEncodingStrategy = dataEncodingStrategy @@ -31,7 +31,7 @@ public final class DictionaryEncoder { // MARK: - Instance Methods - public func encode(_ value: T) throws -> [String: Any] { + public func encode(_ value: T) throws -> [String: Sendable] { let options = DictionaryEncodingOptions( dateEncodingStrategy: dateEncodingStrategy, dataEncodingStrategy: dataEncodingStrategy, @@ -48,7 +48,7 @@ public final class DictionaryEncoder { try value.encode(to: encoder) - guard let dictionary = encoder.resolveValue() as? [String: Any] else { + guard let dictionary = encoder.resolveValue() as? [String: Sendable] else { let errorContext = EncodingError.Context( codingPath: [], debugDescription: "Root component cannot be encoded in Dictionary" diff --git a/Sources/Encoder/Options/DictionaryDataEncodingStrategy.swift b/Sources/Encoder/Options/DictionaryDataEncodingStrategy.swift index f933278..0c851f4 100644 --- a/Sources/Encoder/Options/DictionaryDataEncodingStrategy.swift +++ b/Sources/Encoder/Options/DictionaryDataEncodingStrategy.swift @@ -1,10 +1,10 @@ import Foundation -public enum DictionaryDataEncodingStrategy { +public enum DictionaryDataEncodingStrategy: Sendable { // MARK: - Enumeration Cases case deferredToData case base64 - case custom((_ data: Data, _ encoder: Encoder) throws -> Void) + case custom(@Sendable (_ data: Data, _ encoder: Encoder) throws -> Void) } diff --git a/Sources/Encoder/Options/DictionaryDateEncodingStrategy.swift b/Sources/Encoder/Options/DictionaryDateEncodingStrategy.swift index 6010ab5..92c06cf 100644 --- a/Sources/Encoder/Options/DictionaryDateEncodingStrategy.swift +++ b/Sources/Encoder/Options/DictionaryDateEncodingStrategy.swift @@ -1,6 +1,6 @@ import Foundation -public enum DictionaryDateEncodingStrategy { +public enum DictionaryDateEncodingStrategy: Sendable { // MARK: - Enumeration Cases @@ -13,5 +13,5 @@ public enum DictionaryDateEncodingStrategy { case iso8601 case formatted(DateFormatter) - case custom((_ date: Date, _ encoder: Encoder) throws -> Void) + case custom(@Sendable (_ date: Date, _ encoder: Encoder) throws -> Void) } diff --git a/Sources/Encoder/Options/DictionaryKeyEncodingStrategy.swift b/Sources/Encoder/Options/DictionaryKeyEncodingStrategy.swift index d617ce3..da26126 100644 --- a/Sources/Encoder/Options/DictionaryKeyEncodingStrategy.swift +++ b/Sources/Encoder/Options/DictionaryKeyEncodingStrategy.swift @@ -1,9 +1,9 @@ import Foundation -public enum DictionaryKeyEncodingStrategy { +public enum DictionaryKeyEncodingStrategy: Sendable { // MARK: - Enumeration Cases case useDefaultKeys - case custom((_ codingPath: [CodingKey]) -> CodingKey) + case custom(@Sendable (_ codingPath: [CodingKey]) -> CodingKey) } diff --git a/Sources/Encoder/Options/DictionaryNilEncodingStrategy.swift b/Sources/Encoder/Options/DictionaryNilEncodingStrategy.swift index 0030acb..37abb2a 100644 --- a/Sources/Encoder/Options/DictionaryNilEncodingStrategy.swift +++ b/Sources/Encoder/Options/DictionaryNilEncodingStrategy.swift @@ -1,6 +1,6 @@ import Foundation -public enum DictionaryNilEncodingStrategy { +public enum DictionaryNilEncodingStrategy: Sendable { // MARK: - Enumeration Cases diff --git a/Sources/Encoder/Options/DictionaryNonConformingFloatEncodingStrategy.swift b/Sources/Encoder/Options/DictionaryNonConformingFloatEncodingStrategy.swift index 346ce91..63cffcd 100644 --- a/Sources/Encoder/Options/DictionaryNonConformingFloatEncodingStrategy.swift +++ b/Sources/Encoder/Options/DictionaryNonConformingFloatEncodingStrategy.swift @@ -1,6 +1,6 @@ import Foundation -public enum DictionaryNonConformingFloatEncodingStrategy { +public enum DictionaryNonConformingFloatEncodingStrategy: Sendable { // MARK: - Enumeration Cases