Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.5
6.0
2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.1
16.1
10 changes: 5 additions & 5 deletions DictionaryCoder.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 24 additions & 10 deletions DictionaryCoder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Debug;
};
Expand All @@ -1028,6 +1029,7 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Release;
};
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
};
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -1366,6 +1376,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 13.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1393,6 +1404,7 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 13.0;
};
name = Release;
};
Expand All @@ -1412,6 +1424,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 13.0;
};
name = Debug;
};
Expand All @@ -1431,6 +1444,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 13.0;
};
name = Release;
};
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:6.0
import PackageDescription

let package = Package(
Expand All @@ -20,5 +20,5 @@ let package = Package(
path: "Tests"
)
],
swiftLanguageVersions: [.v5]
swiftLanguageVersions: [.v6]
)
18 changes: 7 additions & 11 deletions Sources/Decoder/DictionaryDecoder.swift
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/Decoder/Options/DictionaryDataDecodingStrategy.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// The strategies for decoding raw data.
public enum DictionaryDataDecodingStrategy {
public enum DictionaryDataDecodingStrategy: Sendable {

// MARK: - Enumeration Cases

Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions Sources/Decoder/Options/DictionaryDateDecodingStrategy.swift
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions Sources/Decoder/Options/DictionaryKeyDecodingStrategy.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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

/// A key decoding strategy that doesn’t change key names during decoding.
case useDefaultKeys

/// A key decoding strategy defined by the closure you supply.
case custom((_ codingPath: [CodingKey]) -> CodingKey)
case custom(@Sendable (_ codingPath: [CodingKey]) -> CodingKey)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 10 additions & 14 deletions Sources/Encoder/DictionaryEncoder.swift
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -35,7 +31,7 @@ public final class DictionaryEncoder {

// MARK: - Instance Methods

public func encode<T: Encodable>(_ value: T) throws -> [String: Any] {
public func encode<T: Encodable>(_ value: T) throws -> [String: Sendable] {
let options = DictionaryEncodingOptions(
dateEncodingStrategy: dateEncodingStrategy,
dataEncodingStrategy: dataEncodingStrategy,
Expand All @@ -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"
Expand Down
Loading
Loading