diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfcb141..3f827c8 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-15 env: - DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_16.2.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 }} @@ -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 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..1018e37 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( @@ -20,5 +20,5 @@ let package = Package( path: "Tests" ) ], - swiftLanguageVersions: [.v5] + swiftLanguageVersions: [.v6] ) diff --git a/Sources/Decoder/DictionaryDecoder.swift b/Sources/Decoder/DictionaryDecoder.swift index 47e4824..1065c6f 100644 --- a/Sources/Decoder/DictionaryDecoder.swift +++ b/Sources/Decoder/DictionaryDecoder.swift @@ -1,18 +1,14 @@ import Foundation -public final class DictionaryDecoder { - - // MARK: - Type Properties - - public static let `default` = 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 @@ -21,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 90137c0..b01971f 100644 --- a/Sources/Encoder/DictionaryEncoder.swift +++ b/Sources/Encoder/DictionaryEncoder.swift @@ -1,19 +1,15 @@ import Foundation -public final class DictionaryEncoder { - - // MARK: - Type Properties - - public static let `default` = 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 @@ -23,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 @@ -35,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, @@ -52,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