From a9a7a6399a4cb77c75713d96f0daf49fbccb4d1e Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Wed, 19 Apr 2023 14:55:39 +0200 Subject: [PATCH 1/2] Added the initialiser function to the MockURLRequest struct. --- .../Communications/Classes/MockURLProtocol.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/Communications/Classes/MockURLProtocol.swift b/Sources/Communications/Classes/MockURLProtocol.swift index 1a92bf6..6a19689 100644 --- a/Sources/Communications/Classes/MockURLProtocol.swift +++ b/Sources/Communications/Classes/MockURLProtocol.swift @@ -75,8 +75,22 @@ public class MockURLProtocol: URLProtocol { /// This model includes the data to be injected into an specific URL at the time of mocking its request. public struct MockURLRequest: Hashable { + + // MARK: Properties + public let method: HTTPRequestMethod public let url: URL + + // MARK: Initialisers + + public init( + method: HTTPRequestMethod, + url: URL + ) { + self.method = method + self.url = url + } + } /// This model includes the data to be injected into an specific URL at the time of mocking its response. -- 2.47.1 From e9d9c9e475165881b7a75105a99621696e52f414 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Wed, 19 Apr 2023 16:14:52 +0200 Subject: [PATCH 2/2] Implemented the "gmt" static property in the TimeZone+Zone extension. --- Sources/Communications/Classes/MockURLProtocol.swift | 1 + Sources/Core/Extensions/TimeZone+Zone.swift | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 Sources/Core/Extensions/TimeZone+Zone.swift diff --git a/Sources/Communications/Classes/MockURLProtocol.swift b/Sources/Communications/Classes/MockURLProtocol.swift index 6a19689..892f1dd 100644 --- a/Sources/Communications/Classes/MockURLProtocol.swift +++ b/Sources/Communications/Classes/MockURLProtocol.swift @@ -17,6 +17,7 @@ public class MockURLProtocol: URLProtocol { // MARK: Properties + /// The dictionary in which the mock requests with its respective mock responses will be injected. public static var mockData: [MockURLRequest: MockURLResponse] = [:] // MARK: Functions diff --git a/Sources/Core/Extensions/TimeZone+Zone.swift b/Sources/Core/Extensions/TimeZone+Zone.swift new file mode 100644 index 0000000..e7a524b --- /dev/null +++ b/Sources/Core/Extensions/TimeZone+Zone.swift @@ -0,0 +1,10 @@ +import Foundation + +public extension TimeZone { + + // MARK: Zones + + /// Greenwich Mean Time or UTC+0 + static let gmt = TimeZone(secondsFromGMT: 0) + +} -- 2.47.1