Skip to content

Commit

Permalink
any codable dates fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KazaiMazai committed May 5, 2021
1 parent c9c7054 commit 9df1bda
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/vapor-rest-kit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "VaporRestKit"
BuildableName = "VaporRestKit"
BlueprintName = "VaporRestKit"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "VaporRestKitTests"
BuildableName = "VaporRestKitTests"
BlueprintName = "VaporRestKitTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "VaporRestKitTests"
BuildableName = "VaporRestKitTests"
BlueprintName = "VaporRestKitTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<EnvironmentVariables>
<EnvironmentVariable
key = "LOG_LEVEL"
value = "trace"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "VaporRestKit"
BuildableName = "VaporRestKit"
BlueprintName = "VaporRestKit"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 2 additions & 0 deletions Sources/VaporRestKit/Utils/AnyCodable/AnyCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ extension AnyCodable: Equatable {
return lhs == rhs
case let (lhs as String, rhs as String):
return lhs == rhs
case let (lhs as Date, rhs as Date):
return lhs == rhs
case (let lhs as [String: AnyCodable], let rhs as [String: AnyCodable]):
return lhs == rhs
case (let lhs as [AnyCodable], let rhs as [AnyCodable]):
Expand Down
4 changes: 4 additions & 0 deletions Sources/VaporRestKit/Utils/AnyCodable/AnyDecodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extension _AnyDecodable {
self.init(double)
} else if let string = try? container.decode(String.self) {
self.init(string)
} else if let date = try? container.decode(Date.self) {
self.init(date)
} else if let array = try? container.decode([AnyCodable].self) {
self.init(array.map { $0.value })
} else if let dictionary = try? container.decode([String: AnyCodable].self) {
Expand Down Expand Up @@ -106,6 +108,8 @@ extension AnyDecodable: Equatable {
return lhs == rhs
case let (lhs as String, rhs as String):
return lhs == rhs
case let (lhs as Date, rhs as Date):
return lhs == rhs
case (let lhs as [String: AnyDecodable], let rhs as [String: AnyDecodable]):
return lhs == rhs
case (let lhs as [AnyDecodable], let rhs as [AnyDecodable]):
Expand Down
6 changes: 6 additions & 0 deletions Sources/VaporRestKit/Utils/AnyCodable/AnyEncodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ extension AnyEncodable: Equatable {
return lhs == rhs
case let (lhs as String, rhs as String):
return lhs == rhs
case let (lhs as Date, rhs as Date):
return lhs == rhs
case (let lhs as [String: AnyEncodable], let rhs as [String: AnyEncodable]):
return lhs == rhs
case (let lhs as [AnyEncodable], let rhs as [AnyEncodable]):
Expand Down Expand Up @@ -196,6 +198,10 @@ extension _AnyEncodable {
self.init(value)
}

init(dateLiteral value: Date) {
self.init(value)
}

init(arrayLiteral elements: Any...) {
self.init(elements)
}
Expand Down

0 comments on commit 9df1bda

Please sign in to comment.